Comparing version 4.0.0 to 4.0.1-node-12-64007eacee103838fdc90b52886301cb6d55e228
@@ -7,2 +7,7 @@ # Change Log | ||
# v4.0.1 | ||
## (2022-07-17) | ||
* support node 12 [Zane Hitchcox] | ||
# v4.0.0 | ||
@@ -9,0 +14,0 @@ ## (2022-07-17) |
@@ -118,4 +118,7 @@ // Maintainers, keep in mind that ES1-style octal literals (`0666`) are not | ||
if (typeof options === 'string') { | ||
if (defaultOptions === undefined) { | ||
defaultOptions = {} | ||
} | ||
options = { | ||
...(defaultOptions ?? {}), | ||
...defaultOptions, | ||
encoding: options, | ||
@@ -354,3 +357,3 @@ }; | ||
position = null, | ||
} = offsetOrOptions ?? kEmptyObject); | ||
} = offsetOrOptions); | ||
} | ||
@@ -369,3 +372,3 @@ if (typeof offsetOrOptions !== 'number') | ||
const buffer = Buffer.from(String(stringOrBuffer)); | ||
const encoding = length ?? 'utf8'; | ||
const encoding = length !== undefined ? length : 'utf8'; | ||
position = offsetOrOptions; | ||
@@ -382,3 +385,3 @@ return writeBuffer(fd, buffer, 0, buffer.byteLength, position) | ||
function writeCb(fd, buffer, offset, length, position, cb) { | ||
cb = cb ?? arguments[arguments.length - 1]; | ||
cb = cb !== undefined ? cb : arguments[arguments.length - 1]; | ||
// follow node fs api and don't return promises | ||
@@ -766,6 +769,6 @@ ;(async () => { | ||
this.path = path; | ||
this.fd = options.fd ?? null; | ||
this.flags = options.flags ?? 'r'; | ||
this.mode = options.mode ?? 0o666; | ||
this.autoClose = options.autoClose ?? true; | ||
this.fd = options.fd !== undefined ? options.fd : null; | ||
this.flags = options.flags !== undefined ? options.flags : 'r'; | ||
this.mode = options.mode !== undefined ? options.mode : 0o666; | ||
this.autoClose = options.autoClose !== undefined ? options.autoClose : true; | ||
this.start = options.start; | ||
@@ -772,0 +775,0 @@ this.bytesWritten = 0; |
{ | ||
"name": "ext2fs", | ||
"version": "4.0.0", | ||
"version": "4.0.1-node-12-64007eacee103838fdc90b52886301cb6d55e228", | ||
"description": "WASM bindings to libext2fs for cross-platform ext filesystem handling", | ||
@@ -49,4 +49,4 @@ "author": "Petros Angelatos <petrosagg@balena.io>", | ||
"versionist": { | ||
"publishedAt": "2022-07-17T01:42:55.351Z" | ||
"publishedAt": "2022-07-17T18:35:05.461Z" | ||
} | ||
} |
@@ -31,10 +31,14 @@ node-ext2fs | ||
To build `node-ext2fs` you need to have `make` and `emcc` from emscripten >= 2.0.7 available on your | ||
environment. | ||
Prerequisites: | ||
Build `node-ext2fs` using `npm`: | ||
* git | ||
* make | ||
* [`emcc` >= 2.0.7](https://emscripten.org/docs/getting_started/downloads.html) | ||
``` bash | ||
$ npm run build | ||
``` | ||
git clone --recursive https://github.com/balena-io-modules/node-ext2fs # clone the repository | ||
cd node-ext2fs | ||
npm i | ||
npm run build | ||
``` | ||
@@ -60,20 +64,20 @@ Usage | ||
async function main() { | ||
const diskImage = '/some/disk.image'; | ||
const offset = 272629760; // offset of the ext partition you want to mount in that disk image | ||
try { | ||
await withOpenFile(diskImage, 'r', async (handle) => { | ||
const disk = new FileDisk(handle); | ||
await withMountedDisk(disk, offset, async (fs, fsPromises) => { | ||
// List files | ||
console.log('readdir', await fsPromises.readdir('/')); | ||
await fs.trim(); | ||
// Show discarded regions | ||
console.log('discarded', disk.getDiscardedChunks()); | ||
// Show ranges of useful data aligned to 1MiB | ||
console.log('ranges', await disk.getRanges(1024 ** 2)); | ||
}); | ||
}); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
const diskImage = '/some/disk.image'; | ||
const offset = 272629760; // offset of the ext partition you want to mount in that disk image | ||
try { | ||
await withOpenFile(diskImage, 'r', async (handle) => { | ||
const disk = new FileDisk(handle); | ||
await withMountedDisk(disk, offset, async (fs, fsPromises) => { | ||
// List files | ||
console.log('readdir', await fsPromises.readdir('/')); | ||
await fs.trim(); | ||
// Show discarded regions | ||
console.log('discarded', disk.getDiscardedChunks()); | ||
// Show ranges of useful data aligned to 1MiB | ||
console.log('ranges', await disk.getRanges(1024 ** 2)); | ||
}); | ||
}); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
} | ||
@@ -80,0 +84,0 @@ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
413210
5707
98
1