Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(volume): now handling Buffer as volume content #880

Merged
merged 2 commits into from
Sep 25, 2023
Merged

feat(volume): now handling Buffer as volume content #880

merged 2 commits into from
Sep 25, 2023

Conversation

shorwood
Copy link
Contributor

@shorwood shorwood commented Nov 12, 2022

code.png

Context

Hi ! While trying to inject some Buffer into a memfs volume from the fromJSON method, I noticed it creates a virtual folder. I expected the method to accept Buffer as content but I noticed only string are "allowed".

This PR resolves cases when you want to inject raw binary data into your volumes. For example when you have some test archives to validate.

Actions

I have written a small patch to fix the issue. I tried to make as few changes as possible. It comes with a new test and some adjustments to the documentation.

I hope it's enough for a quick merge. If not, feel free to share adjustments you would like to be done. I'll try to be as reactive as possible.

Best regards,

Stanley.

src/__tests__/volume.test.ts Outdated Show resolved Hide resolved
src/__tests__/volume.test.ts Outdated Show resolved Hide resolved
src/volume.ts Show resolved Hide resolved
@shorwood
Copy link
Contributor Author

bump

Copy link
Collaborator

@G-Rath G-Rath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to apply prettier

src/__tests__/volume.test.ts Outdated Show resolved Hide resolved
@shorwood shorwood closed this Feb 14, 2023
@shorwood shorwood reopened this Feb 14, 2023
@shorwood
Copy link
Contributor Author

You need to apply prettier

Done.

@shorwood shorwood requested a review from G-Rath February 14, 2023 20:57
@G-Rath
Copy link
Collaborator

G-Rath commented Sep 15, 2023

@shorwood are you able to rebase this please?

@shorwood shorwood closed this Sep 18, 2023
This commit resolves cases when you want to inject raw binary (`Buffer`)
data into your virtual volumes. For example when you want to validate
an archive extracts files correctly.
@shorwood
Copy link
Contributor Author

shorwood commented Sep 18, 2023

@shorwood are you able to rebase this please?

Hi, it's done. Sorry for the close/reopen, I had to sync and cherry pick because rebase was taking too long on my PC. I have also taken the opportunity to reword them a bit for better understanding.

Awaiting your feedback.

@G-Rath G-Rath merged commit 9c0a6ff into streamich:master Sep 25, 2023
10 checks passed
github-actions bot pushed a commit that referenced this pull request Sep 25, 2023
# [4.5.0](v4.4.0...v4.5.0) (2023-09-25)

### Features

* **volume:** `fromJSON` now accepts `Buffer` as volume content ([#880](#880)) ([9c0a6ff](9c0a6ff))
@streamich
Copy link
Owner

🎉 This PR is included in version 4.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants