Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: streamich/memfs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.9.3
Choose a base ref
...
head repository: streamich/memfs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.9.4
Choose a head ref
  • 4 commits
  • 6 files changed
  • 4 contributors

Commits on Jul 1, 2024

  1. chore(deps): lock file maintenance

    renovate[bot] committed Jul 1, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    1193b6e View commit details

Commits on Jul 5, 2024

  1. docs: add security policy

    [skip ci]
    streamich authored Jul 5, 2024
    Copy the full SHA
    5f9ed10 View commit details

Commits on Jul 23, 2024

  1. fix: ensure files in subdirectories are returned as buffers when call…

    …ing `toJSON` with `asBuffer` (#1041)
    
    * Volume.toJSON: correctly propagate asBuffer in recursive calls
    
    * Add a test for volume.toJSON when serializing files as Buffers
    elegaanz authored Jul 23, 2024
    Copy the full SHA
    c3d4cf3 View commit details
  2. chore(release): 4.9.4 [skip ci]

    ## [4.9.4](v4.9.3...v4.9.4) (2024-07-23)
    
    ### Bug Fixes
    
    * ensure files in subdirectories are returned as buffers when calling `toJSON` with `asBuffer` ([#1041](#1041)) ([c3d4cf3](c3d4cf3))
    semantic-release-bot committed Jul 23, 2024
    Copy the full SHA
    3872068 View commit details
Showing with 297 additions and 256 deletions.
  1. +7 −0 CHANGELOG.md
  2. +13 −0 SECURITY.md
  3. +1 −1 package.json
  4. +9 −0 src/__tests__/volume.test.ts
  5. +1 −1 src/volume.ts
  6. +266 −254 yarn.lock
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [4.9.4](https://github.com/streamich/memfs/compare/v4.9.3...v4.9.4) (2024-07-23)


### Bug Fixes

* ensure files in subdirectories are returned as buffers when calling `toJSON` with `asBuffer` ([#1041](https://github.com/streamich/memfs/issues/1041)) ([c3d4cf3](https://github.com/streamich/memfs/commit/c3d4cf36e438f7fef2dab4639c08449ceada28a3))

## [4.9.3](https://github.com/streamich/memfs/compare/v4.9.2...v4.9.3) (2024-06-14)


13 changes: 13 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Security Policy

## Supported Versions

We release patches for security vulnerabilities. The latest major version
will support security patches.

## Reporting a Vulnerability

Please report (suspected) security vulnerabilities to
**[streamich@gmail.com](mailto:streamich@gmail.com)**. We will try to respond
within 48 hours. If the issue is confirmed, we will release a patch as soon
as possible depending on complexity.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "memfs",
"version": "4.9.3",
"version": "4.9.4",
"description": "In-memory file-system with Node's fs API.",
"keywords": [
"fs",
9 changes: 9 additions & 0 deletions src/__tests__/volume.test.ts
Original file line number Diff line number Diff line change
@@ -196,6 +196,15 @@ describe('volume', () => {
const result = vol.toJSON('/', {}, false, true)['/file'];
expect(result).toStrictEqual(buffer);
});

it('Outputs files in subdirectories as buffers too', () => {
const buffer = Buffer.from('Hello');
const vol = new Volume();
vol.mkdirSync('/dir');
vol.writeFileSync('/dir/file', buffer);
const result = vol.toJSON('/', {}, false, true)['/dir/file'];
expect(result).toStrictEqual(buffer);
});
});

describe('.fromJSON(json[, cwd])', () => {
2 changes: 1 addition & 1 deletion src/volume.ts
Original file line number Diff line number Diff line change
@@ -554,7 +554,7 @@ export class Volume implements FsCallbackApi, FsSynchronousApi {
if (path) filename = relative(path, filename);
json[filename] = asBuffer ? node.getBuffer() : node.getString();
} else if (node.isDirectory()) {
this._toJSON(child, json, path);
this._toJSON(child, json, path, asBuffer);
}
}

Loading