Comparing version 5.1.0 to 5.1.1-resin-lint-3-240051b9a61cb5ae743bb4e27a6814d9efcbd240
@@ -16,3 +16,3 @@ /// <reference types="node" /> | ||
} | ||
export declare const read: (fd: number, buffer: Buffer, offset: number, length: number, position: number) => Bluebird<ReadResult>; | ||
export declare const write: (fd: number, buffer: Buffer, offset: number, length: number, position: number) => Bluebird<WriteResult>; | ||
export declare const read: (fd: number, buf: Buffer, offset: number, length: number, position: number) => Promise<ReadResult>; | ||
export declare const write: (fd: number, buf: Buffer, offset: number, length: number, position: number) => Promise<WriteResult>; |
@@ -5,7 +5,2 @@ "use strict"; | ||
const fs = require("fs"); | ||
const _read = Bluebird.promisify(fs.read, { context: fs, multiArgs: true }); | ||
const _write = Bluebird.promisify(fs.write, { | ||
context: fs, | ||
multiArgs: true, | ||
}); | ||
exports.open = Bluebird.promisify(fs.open, { context: fs }); | ||
@@ -15,12 +10,26 @@ exports.close = Bluebird.promisify(fs.close, { context: fs }); | ||
exports.fdatasync = Bluebird.promisify(fs.fdatasync, { context: fs }); | ||
exports.read = (fd, buffer, offset, length, position) => { | ||
return _read(fd, buffer, offset, length, position).spread((bytesRead, buffer) => { | ||
return { bytesRead, buffer }; | ||
exports.read = (fd, buf, offset, length, position) => { | ||
return new Promise((resolve, reject) => { | ||
fs.read(fd, buf, offset, length, position, (error, bytesRead, buffer) => { | ||
if (error !== null) { | ||
reject(error); | ||
} | ||
else { | ||
resolve({ bytesRead, buffer }); | ||
} | ||
}); | ||
}); | ||
}; | ||
exports.write = (fd, buffer, offset, length, position) => { | ||
return _write(fd, buffer, offset, length, position).spread((bytesWritten, buffer) => { | ||
return { bytesWritten, buffer }; | ||
exports.write = (fd, buf, offset, length, position) => { | ||
return new Promise((resolve, reject) => { | ||
fs.write(fd, buf, offset, length, position, (error, bytesWritten, buffer) => { | ||
if (error !== null) { | ||
reject(error); | ||
} | ||
else { | ||
resolve({ bytesWritten, buffer }); | ||
} | ||
}); | ||
}); | ||
}; | ||
//# sourceMappingURL=fs.js.map |
@@ -32,3 +32,3 @@ /// <reference types="node" /> | ||
getTransformStream(): Transform; | ||
read(buffer: Buffer, bufferOffset: number, length: number, fileOffset: number): Promise<fs.ReadResult>; | ||
read(buffer: Buffer, _bufferOffset: number, length: number, fileOffset: number): Promise<fs.ReadResult>; | ||
write(buffer: Buffer, bufferOffset: number, length: number, fileOffset: number): Promise<fs.WriteResult>; | ||
@@ -35,0 +35,0 @@ flush(): Promise<void>; |
@@ -81,3 +81,3 @@ "use strict"; | ||
} | ||
_transform(chunk, enc, cb) { | ||
_transform(chunk, _enc, cb) { | ||
const start = this.position; | ||
@@ -149,3 +149,3 @@ const end = start + chunk.length - 1; | ||
} | ||
read(buffer, bufferOffset, length, fileOffset) { | ||
read(buffer, _bufferOffset, length, fileOffset) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -257,11 +257,9 @@ const plan = this.createReadPlan(fileOffset, length); | ||
if (!this.discardIsZero) { | ||
chunks = chunks.filter(chunk => { | ||
return !(chunk instanceof diskchunk_1.DiscardDiskChunk); | ||
}); | ||
chunks = chunks.filter(c => !(c instanceof diskchunk_1.DiscardDiskChunk)); | ||
} | ||
const intersections = []; | ||
chunks.forEach(chunk => { | ||
const inter = interval_intersection_1.intervalIntersection(interval, chunk.interval()); | ||
chunks.forEach(c => { | ||
const inter = interval_intersection_1.intervalIntersection(interval, c.interval()); | ||
if (inter !== null) { | ||
intersections.push(chunk.slice(inter[0], inter[1])); | ||
intersections.push(c.slice(inter[0], inter[1])); | ||
} | ||
@@ -362,3 +360,5 @@ }); | ||
_flush() { | ||
return __awaiter(this, void 0, void 0, function* () { }); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
// Nothing to do to flush a BufferDisk | ||
}); | ||
} | ||
@@ -365,0 +365,0 @@ } |
@@ -7,2 +7,8 @@ # Change Log | ||
## 5.1.1 - 2019-03-21 | ||
* Don't use bluebird for promisifying fs read and write [Alexis Svinartchouk] | ||
* Update resin-lint to ^3.0.1 [Alexis Svinartchouk] | ||
* Add noImplicitAny, noUnusedLocals, noUnusedParameters and strictNullChecks [Alexis Svinartchouk] | ||
## 5.1.0 - 2018-12-21 | ||
@@ -9,0 +15,0 @@ |
{ | ||
"name": "file-disk", | ||
"version": "5.1.0", | ||
"version": "5.1.1-resin-lint-3-240051b9a61cb5ae743bb4e27a6814d9efcbd240", | ||
"description": "Handles reads / writes on disk image files.", | ||
@@ -39,3 +39,3 @@ "author": "Petros Angelatos <petrosagg@balena.io>", | ||
"mocha": "^5.2.0", | ||
"resin-lint": "^2.0.1", | ||
"resin-lint": "^3.0.1", | ||
"ts-node": "7.0.1", | ||
@@ -42,0 +42,0 @@ "typescript": "^3.1.6" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
66208
724
1