1 | {"version":3,"sources":["../src/virtual-buffer.spec.js"],"names":[],"mappings":";;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;;;AAEA,qBAAS,gBAAT,EAA2B,YAAY;AAAA;;AACrC,iBAAG,2BAAH,6DAAgC;AAAA;AAAA;AAAA;AAAA;AAAA;AAC1B,uBAD0B,GACZ,aADY;AAAA;AAAA,mBAExB,+BAAK,4CAA4C,WAAjD,CAFwB;;AAAA;AAGxB,kBAHwB,GAGf,iCAAkB,iCAAiB,WAAjB,CAAlB,CAHe;AAAA;AAAA,mBAIV,OAAO,SAAP,CAAiB,EAAjB,CAJU;;AAAA;AAIxB,iBAJwB;AAAA;AAAA,mBAKV,OAAO,SAAP,CAAiB,CAAC,CAAlB,CALU;;AAAA;AAKxB,iBALwB;AAAA;AAAA,mBAMP,yBAAS,WAAT,CANO;;AAAA;AAMxB,oBANwB;;AAO9B,8BAAO,OAAO,UAAd,EAA0B,4BAA1B;AACA,yBAAO,KAAP,CAAa,OAAO,MAAP,CAAc,CAAC,KAAD,EAAQ,KAAR,CAAd,EAA8B,QAA9B,CAAuC,OAAvC,CAAb,EAA8D,SAAS,QAAT,CAAkB,OAAlB,CAA9D;;AAR8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAAhC;AAUD,CAXD","file":"virtual-buffer.spec.js","sourcesContent":["import {assert} from 'chai'\nimport {createReadStream, readFile} from 'fs-promise'\nimport {describe, it} from 'mocha'\nimport {exec} from 'child-process-promise'\n\nimport {VirtualBuffer} from './virtual-buffer'\n\ndescribe('Virtual Buffer', function () {\n it('can read a file correctly', async () => {\n let rawFileName = 'random-data'\n await exec('base64 /dev/urandom | head -c 104448 > ' + rawFileName)\n const buffer = new VirtualBuffer(createReadStream(rawFileName))\n const part1 = await buffer.readChunk(10)\n const part2 = await buffer.readChunk(-1)\n const original = await readFile(rawFileName)\n assert(buffer.isDepleted, 'virtual buffer is depleted')\n assert.equal(Buffer.concat([part1, part2]).toString('ascii'), original.toString('ascii'))\n })\n})\n"]} |