Bert Belder
8d70294c31
Fix fs.realpathSync on windows
2011-02-08 21:24:30 -08:00
isaacs
9bed5dcb2c
Support caching for realpath, use in module load
...
This adds support for a cache object to be passed to the
fs.realpath and fs.realpathSync functions. The Module loader keeps an
object around which caches the resulting realpaths that it looks up in
the process of loading modules.
This means that (at least as a result of loading modules) the same files
and folders are never lstat()ed more than once. To reset the cache, set
require("module")._realpathCache to an empty object. To disable the
caching behavior, set it to null.
2011-02-08 18:02:59 -08:00
isaacs
5f2e90934e
Support octal strings for modes
...
This allows the various fs utilities and process.umask to be used in
ECMAScript 5 Strict Mode, where the octal literal format is verboten,
without requiring users to litter their code with a bunch of parseInt
calls.
2011-02-07 14:05:06 -08:00
Ryan Dahl
5a05992155
Lint
2011-01-06 16:06:27 -08:00
Bert Belder
dea2331377
Rework fs.realpath, primordal windows compatibility
2011-01-06 15:38:50 -08:00
Ryan Dahl
cda4d56bcf
Implement WriteStream.destroySoon
2011-01-04 11:39:12 -08:00
Ryan Dahl
2957382991
Implement new stream method, destroySoon
...
Still missing on fs.WriteStream
2011-01-04 11:22:19 -08:00
Ryan Dahl
09329cbb04
more lint
2010-12-01 17:43:30 -08:00
Evan Larkin
bc02d47b21
Fix variable leak.
...
Fixes issue 461
2010-11-29 17:07:25 -08:00
isaacs
9996b459e1
Implement new path.join behavior
...
1. Express desired path.join behavior in tests.
2. Update fs.realpath to reflect new path.join behavior
3. Update url.resolve() to use new path.join behavior.
2010-11-14 22:49:26 -08:00
isaacs
589e27948b
writeFile fixes
...
writeFileSync could exhibit pathological behavior when a buffer could
not be written to the file in a single write() call.
Also, writeFile was not quite as optimized as it could be.
2010-11-14 01:43:30 -08:00
Chandra Sekar S
2b08bacd56
Removed range read optimization as it doesn't work with libeio.
2010-11-01 08:28:57 -07:00
isaacs
987cbbc191
Handle cyclic links smarter in fs.realpath
...
Rather than aborting in the face of *any* repeated link in a given path,
instead only abort if such a cycle actually makes a given path unresolvable.
Test for this by doing a normal stat. Still use the seenLinks object to
cache link contents so as to cut own a little bit on readlink calls.
Also add a pathological test that fails without the change to fs.js.
2010-10-27 17:02:42 -07:00
Ryan Dahl
901d5fd0d2
Don't require events in fs.js
2010-10-11 16:40:28 -07:00
Ryan Dahl
32aadd9400
fs.ReadStream and fs.WriteStream derive from stream.Stream
2010-10-11 16:39:40 -07:00
Micheil Smith
7bfefb5250
Removed deprecated methods from lib/fs.js
2010-10-11 16:20:08 -07:00
Micheil Smith
e38eb0c5a4
Soft migration of sys -> util, Removal of deprecated utils module.
2010-10-11 15:21:36 -07:00
Joshaven Potter
3d4e4d8909
syntax fixes to pass jslint
2010-10-06 20:40:57 -07:00
isaacs
8ff7954165
Fix #325 . Add test and check for zero-length file contents in fs.readFileSync
2010-10-04 12:50:58 -07:00
Marco Rogers
4a7562d28f
fix encoding option on ReadStream, updated test
2010-10-01 15:16:25 -07:00
Evan Larkin
914ff78df6
fs.ReadStream: Passing null for file position on all reads except the first read of a range read.
2010-09-30 18:23:30 -07:00
Evan Larkin
43ddc04bb0
No longer using the global variable "stat" in unwatchFile
2010-09-30 16:19:59 -07:00
Ryan Dahl
f323f34353
writeable -> writable
2010-09-29 16:12:30 -07:00
Ryan Dahl
069d973d74
Remove require('buffer') in built-in libraries.
2010-09-28 02:31:31 -07:00
isaacs
4d0456f827
Don't use stat in fs.readFile[Sync]
...
Original patch c/o Evan Larkin <evan.larkin.iit@gmail.com>
2010-09-22 22:06:32 -07:00
Tj Holowaychuk
893ebe7230
Fixed fs.ReadStream() start: 0 bug
2010-09-22 10:22:43 -07:00
Ryan Dahl
6eca948ca2
Move constants out of process object
2010-09-16 23:16:07 -07:00
Ryan Dahl
bbbcd1fee0
Safe constructors for fs.ReadStream and fs.WriteStream
2010-09-16 19:04:09 -07:00
isaacs
686d9f9cc6
Bug in realpath with symlinks to absolute folder paths which have children.
...
Found by Cliffano Subagio
http://groups.google.com/group/nodejs/browse_thread/thread/f46f093938265ac0/387e14da08c7dd7b ?
2010-09-14 10:27:57 -07:00
Ryan Dahl
3a9570386a
Fix fs.realpathSync('/')
2010-09-09 18:49:28 -07:00
isaacs
ba0c32e2e1
Fix issue #262 . Allow fs.realpath to traverse above the current working directory.
2010-09-08 17:35:58 -07:00
Ryan Dahl
0e501f4ec5
Fix style; undefined reference bug
2010-09-08 12:03:33 -07:00
Tobie Langel
ccf4afa256
Do not emit WriteStream's drain event before ws.write has been called.
2010-09-08 11:58:54 -07:00
Tobie Langel
f5e4047064
Avoid closing a WriteStream before it has been opened.
2010-09-08 11:51:29 -07:00
Tobie Langel
75f922c863
Avoid missing ref error in WriteStream.prototype.destroy().
2010-09-08 11:50:56 -07:00
Ryan Dahl
24ac87f543
Increase ReadStream bufferSize to 64k
2010-09-08 10:14:04 -07:00
Ryan Dahl
3c00ec4e48
typo: forceClose -> destroy for WriteStreams
2010-09-05 02:27:02 -07:00
Marco Rogers
af9aa93e0c
fix for fs.readFile to return string when encoding specified on zero length read
2010-08-30 14:08:18 -07:00
Marco Rogers
9c7c6e93e1
Fixed async fs writes with length 0, it should fire the callback
2010-08-30 13:58:50 -07:00
Russell Haering
6078c37be5
Modify fs.open to use accept a callback without a mode
2010-08-23 02:42:25 -07:00
Marco Rogers
6744e59e46
detect 0 length fs writes with tests
2010-08-16 23:57:01 -07:00
Ryan Dahl
3d551e5538
Close fd on readFile(emptyfile)
2010-08-10 14:47:40 -07:00
Chandra Sekar S
f5f7cb9264
Support for reading byte ranges from files using fs.createReadStream.
2010-07-21 11:33:35 -07:00
Ryan Dahl
458bbb4687
fs.writeSync should return bytes written
2010-07-16 19:05:28 -07:00
Ryan Dahl
02729d4af7
instanceof Buffer to Buffer.isBuffer()
2010-07-15 15:58:35 -07:00
Aaron Heckmann
1d088fb906
fs.writeFile accepts Buffers
2010-06-15 23:58:32 -07:00
Peter Dekkers
e48f0d1dd9
Fixed incorrect mask for determining fs.Stats types
2010-06-15 19:52:37 -07:00
Ryan Dahl
6bed15e074
Refactor: Utf8Decoder -> StringDecoder
...
Instead of just decoding Utf8, this will proxy requests to buffer.toString()
for other encodings. This makes for a simpler interface.
2010-06-15 18:19:27 -07:00
Felix Geisendörfer
5f3906b65e
Fix: fs.writeFile could not handle utf8
2010-06-14 10:58:17 -07:00
Felix Geisendörfer
55e964ec19
Fix: fs.readFile would execute callbacks twice
...
fs.readFile was executing a callback in a try..catch context, which is
a problem in itself. To make matters worse, it would re-execute the
same callback if there was an execution.
This patch fixes both of these problems.
2010-06-03 09:40:40 -07:00