fs: write strings directly to disk

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 commit is contained in:
Trevor Norris committed 2013-07-30 14:42:30 -07:00
1 parent 63fc6a63c8
commit 7ca77eaf38
4 files changed
+184 -77

No files matched your search

+3 -1
View File
@@ -239,7 +239,9 @@ bool StringBytes::GetExternalParts(Handle<Value> val,
return true;
}
assert(val->IsString());
if (!val->IsString())
return false;
Local<String> str = Local<String>::New(val.As<String>());
if (str->IsExternalAscii()) {