{“ast”:null,“code”:“'use strict';nnvar utils = require('../utils');nnfunction DataReader(data) {n this.data = data; // type : see implementationnn this.length = data.length;n this.index = 0;n this.zero = 0;n}nnDataReader.prototype = {n /**n * Check that the offset will not go too far.n * @param {string} offset the additional offset to check.n * @throws {Error} an Error if the offset is out of bounds.n */n checkOffset: function checkOffset(offset) {n this.checkIndex(this.index + offset);n },nn /**n * Check that the specified index will not be too far.n * @param {string} newIndex the index to check.n * @throws {Error} an Error if the index is out of bounds.n */n checkIndex: function checkIndex(newIndex) {n if (this.length < this.zero + newIndex || newIndex < 0) {n throw new Error("End of data reached (data length = " + this.length + ", asked index = " + newIndex + "). Corrupted zip ?");n }n },nn /**n * Change the index.n * @param {number} newIndex The new index.n * @throws {Error} if the new index is out of the data.n */n setIndex: function setIndex(newIndex) {n this.checkIndex(newIndex);n this.index = newIndex;n },nn /**n * Skip the next n bytes.n * @param {number} n the number of bytes to skip.n * @throws {Error} if the new index is out of the data.n */n skip: function skip(n) {n this.setIndex(this.index + n);n },nn /**n * Get the byte at the specified index.n * @param {number} i the index to use.n * @return {number} a byte.n */n byteAt: function byteAt(i) {// see implementationsn },nn /**n * Get the next number with a given byte size.n * @param {number} size the number of bytes to read.n * @return {number} the corresponding number.n */n readInt: function readInt(size) {n var result = 0,n i;n this.checkOffset(size);nn for (i = this.index + size - 1; i >= this.index; i–) {n result = (result << 8) + this.byteAt(i);n }nn this.index += size;n return result;n },nn /**n * Get the next string with a given byte size.n * @param {number} size the number of bytes to read.n * @return {string} the corresponding string.n */n readString: function readString(size) {n return utils.transformTo("string", this.readData(size));n },nn /**n * Get raw data without conversion, <size> bytes.n * @param {number} size the number of bytes to read.n * @return {Object} the raw data, implementation specific.n */n readData: function readData(size) {// see implementationsn },nn /**n * Find the last occurence of a zip signature (4 bytes).n * @param {string} sig the signature to find.n * @return {number} the index of the last occurence, -1 if not found.n */n lastIndexOfSignature: function lastIndexOfSignature(sig) {// see implementationsn },nn /**n * Read the signature (4 bytes) at the current position and compare it with sig.n * @param {string} sig the expected signaturen * @return {boolean} true if the signature matches, false otherwise.n */n readAndCheckSignature: function readAndCheckSignature(sig) {// see implementationsn },nn /**n * Get the next date.n * @return {Date} the date.n */n readDate: function readDate() {n var dostime = this.readInt(4);n return new Date(Date.UTC((dostime >> 25 & 0x7f) + 1980, // yearn (dostime >> 21 & 0x0f) - 1, // monthn dostime >> 16 & 0x1f, // dayn dostime >> 11 & 0x1f, // hourn dostime >> 5 & 0x3f, // minuten (dostime & 0x1f) << 1)); // secondn }n};nmodule.exports = DataReader;”,“map”:null,“metadata”:{},“sourceType”:“module”}