Comparing version 4.0.2-disable-catch-exit-2f53e0fa477bd9c56ae4fb92d51c1b92f13a568f to 4.1.0-backward-compatible-3dec45b2840f94a92a6e0012b8da5b5c63a7b562
@@ -7,6 +7,6 @@ # Change Log | ||
# v4.0.2 | ||
# v4.1.0 | ||
## (2022-07-18) | ||
* Makefile: disable NODEJS_CATCH_EXIT [Joseph Kogut] | ||
* Fix breaking change with promises [Zane Hitchcox] | ||
@@ -13,0 +13,0 @@ # v4.0.1 |
@@ -23,8 +23,8 @@ 'use strict'; | ||
} | ||
const [fs, fsPromises] = createFs(fsPointer); | ||
fs.trim = fsPromises.trim = async () => { | ||
const fs = createFs(fsPointer); | ||
fs.trim = fs.promises.trim = async () => { | ||
await ccallThrowAsync('node_ext2fs_trim', 'number', ['number'], [fsPointer]); | ||
}; | ||
fs.diskId = fsPromises.trim = diskId; | ||
return [fs, fsPromises]; | ||
fs.diskId = fs.promises.diskId = diskId; | ||
return fs; | ||
}; | ||
@@ -39,5 +39,5 @@ | ||
exports.withMountedDisk = async function(disk, offset, fn) { | ||
const [fs, fsPromises] = await exports.mount(disk, offset); | ||
const fs = await exports.mount(disk, offset); | ||
try { | ||
return await fn(fs, fsPromises); | ||
return await fn(fs); | ||
} finally { | ||
@@ -44,0 +44,0 @@ await exports.umount(fs); |
@@ -29,3 +29,2 @@ // Maintainers, keep in mind that ES1-style octal literals (`0666`) are not | ||
const kFd = Symbol("fd"); | ||
const kEmptyObject = Object.freeze({}); | ||
@@ -387,4 +386,3 @@ // Same constants for all platforms: | ||
try { | ||
let bytesWritten, outBuffer; | ||
({ bytesWritten, buffer:outBuffer } = await write(fd, buffer, offset, length, position)); | ||
const { bytesWritten, buffer:outBuffer } = await write(fd, buffer, offset, length, position); | ||
cb(null, bytesWritten, outBuffer); | ||
@@ -1198,3 +1196,5 @@ } catch (err) { | ||
} | ||
return [fs, fsPromises]; | ||
fs.promises = fsPromises; | ||
return fs; | ||
}; |
{ | ||
"name": "ext2fs", | ||
"version": "4.0.2-disable-catch-exit-2f53e0fa477bd9c56ae4fb92d51c1b92f13a568f", | ||
"version": "4.1.0-backward-compatible-3dec45b2840f94a92a6e0012b8da5b5c63a7b562", | ||
"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-18T15:23:25.504Z" | ||
"publishedAt": "2022-07-18T16:53:57.495Z" | ||
} | ||
} |
@@ -19,4 +19,3 @@ node-ext2fs | ||
Installation | ||
------------ | ||
## Installation | ||
@@ -29,21 +28,5 @@ Simply install `node-ext2fs` using `npm`: | ||
Building | ||
-------- | ||
Prerequisites: | ||
## Usage | ||
* git | ||
* make | ||
* [`emcc` >= 2.0.7](https://emscripten.org/docs/getting_started/downloads.html) | ||
``` | ||
git clone --recursive https://github.com/balena-io-modules/node-ext2fs # clone the repository | ||
cd node-ext2fs | ||
npm i | ||
npm run build | ||
``` | ||
Usage | ||
----- | ||
Mount a disk image and use the returned `fs` object. | ||
@@ -56,4 +39,3 @@ The fs returned object behaves like node's `fs` except it doesn't provide any | ||
Example | ||
------- | ||
## Example | ||
@@ -63,3 +45,2 @@ ```javascript | ||
const { FileDisk, withOpenFile } = require('file-disk'); | ||
const { promisify } = require('util'); | ||
@@ -72,5 +53,5 @@ async function main() { | ||
const disk = new FileDisk(handle); | ||
await withMountedDisk(disk, offset, async (fs, fsPromises) => { | ||
await withMountedDisk(disk, offset, async ({promises:fs}) => { | ||
// List files | ||
console.log('readdir', await fsPromises.readdir('/')); | ||
console.log('readdir', await fs.readdir('/')); | ||
await fs.trim(); | ||
@@ -89,10 +70,46 @@ // Show discarded regions | ||
``` | ||
## Building | ||
Support | ||
------- | ||
- Prerequisites | ||
* git | ||
* make | ||
* NodeJS >=v12 | ||
- Install emscripten | ||
``` | ||
# Get the emsdk repo | ||
git clone https://github.com/emscripten-core/emsdk.git | ||
# Enter that directory | ||
cd emsdk | ||
# Download and install the latest SDK tools. | ||
./emsdk install latest | ||
# Make the "latest" SDK "active" for the current user. (writes .emscripten file) | ||
./emsdk activate latest | ||
# Activate PATH and other environment variables in the current terminal | ||
source ./emsdk_env.sh | ||
``` | ||
- Clone recursively | ||
``` | ||
# You must clone recursively in order to get the dependency | ||
git clone --recursive https://github.com/balena-io-modules/node-ext2fs | ||
``` | ||
- Build | ||
``` | ||
cd node-ext2fs | ||
npm i | ||
npm run build | ||
``` | ||
## Support | ||
If you're having any problems, please [raise an issue][github-issue] on GitHub. | ||
License | ||
------- | ||
## License | ||
@@ -99,0 +116,0 @@ node-ext2fs is free software, and may be redistributed under the terms specified |
Sorry, the diff of this file is too big to display
413535
5706
115