This repository was archived by the owner on Apr 22, 2023. It is now read-only.
fs: write strings directly to disk#5747
Merged
trevnorris merged 2 commits intonodejs:masterfrom Jul 30, 2013
trevnorris:fs-no-buffer-first
Merged
fs: write strings directly to disk#5747trevnorris merged 2 commits intonodejs:masterfrom trevnorris:fs-no-buffer-first
trevnorris merged 2 commits intonodejs:masterfrom
trevnorris:fs-no-buffer-first
Conversation
doc/api/fs.markdown
Outdated
|
lgtm, but @bnoordhuis or @tjfontaine or @indutny should weigh in on the C++ bits as well. |
src/node_file.cc
Outdated
Member
|
LGTM save for the uv_fs_write() thing but that's contingent on a new libuv release. |
Author
|
@bnoordhuis thanks, I'll wait for the next libuv version to land before landing this. |
The method is useful elsewhere when needing to check if external and grab data.
Prior, strings would first be converted to a Buffer before being written to disk. Now the intermediary step has been removed. Other changes of note: * Class member "must_free" was added to req_wrap so to track if the memory needs to be manually cleaned up after use. * External String Resource support, so the memory will be used directly instead of copying out the data. * Docs have been updated to reflect that if position is not a number then it will assume null. Previously it specified the argument must be null, but that was not how the code worked. An attempt was made to only support == null, but there were too many tests that assumed != number would be enough. * Docs update show some of the write/writeSync arguments are optional.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Instead of first converting the string to a
Bufferinstance, use the string data directly to write to disk.This partially addresses #5607