Ben Noordhuis
c381662cac
fs: make fs.symlink() with no callback async
...
Fix a bug where fs.symlink('foo', 'bar') executed symlink(2) synchronously.
2012-06-06 21:08:38 +02:00
Andreas Madsen
1f3e4a76f9
fs: no end emit after createReadStream.pause()
...
In case a fd option is given to fs.createReadStream a read will instantly
happen. But in the edge case where fd point to an empty file and .pause()
was executed instantly, the end event would emit since no async wait was
between fs.createReadStream and the file read there emits end.
2012-05-27 20:00:19 +02:00
Igor Zinkovsky
39e25528eb
windows: enable creating directory junctions with fs.symlink
2012-05-24 01:15:15 -07:00
Andreas Madsen
a039bad299
fs.watch should not require a listener arguments
...
Since fs.watch returns an event emitter where the change event is exactly
the same as the listener callback, the argument should be required
2012-05-19 18:58:28 -03:00
isaacs
1a2255ab44
Faster fs.readFile and fs.readFileSync
2012-05-16 20:04:44 -07:00
Kevin Bowman
dfcdd5b8aa
fs: add sync open flags 'rs' and 'rs+'
2012-05-16 00:14:46 +02:00
isaacs
643f00d3f9
Merge branch 'master' into v0.6-merge
...
Conflicts:
src/node.cc
2012-05-15 14:21:22 -07:00
isaacs
5164ae3838
Merge remote-tracking branch 'ry/v0.6' into v0.6-merge
...
Conflicts:
ChangeLog
deps/uv/include/uv-private/uv-unix.h
deps/uv/src/unix/core.c
deps/uv/src/unix/sunos.c
deps/v8/src/runtime.cc
doc/api/crypto.markdown
lib/http.js
src/node_version.h
test/gc/test-http-client-timeout.js
wscript
2012-05-15 11:37:34 -07:00
Ben Noordhuis
25aea2a072
fs: hook up handle wrap to owning object
2012-05-15 16:56:49 +02:00
Bert Belder
d8351a2ef4
Automatically close FSWatcher on error
...
Closes #3250
2012-05-13 03:16:19 +02:00
koichik
5f9ffa17b1
fs: fix ReadStream.pause() emits duplicate data event
...
Fixes #3258 .
2012-05-12 10:24:46 +09:00
isaacs
01d146c29f
Merge remote-tracking branch 'ry/v0.6' into v0.6-merge
...
Conflicts:
ChangeLog
Makefile
deps/npm/AUTHORS
deps/npm/html/api/bin.html
deps/npm/html/api/bugs.html
deps/npm/html/api/commands.html
deps/npm/html/api/config.html
deps/npm/html/api/deprecate.html
deps/npm/html/api/docs.html
deps/npm/html/api/edit.html
deps/npm/html/api/explore.html
deps/npm/html/api/help-search.html
deps/npm/html/api/init.html
deps/npm/html/api/install.html
deps/npm/html/api/link.html
deps/npm/html/api/load.html
deps/npm/html/api/ls.html
deps/npm/html/api/npm.html
deps/npm/html/api/outdated.html
deps/npm/html/api/owner.html
deps/npm/html/api/pack.html
deps/npm/html/api/prefix.html
deps/npm/html/api/prune.html
deps/npm/html/api/publish.html
deps/npm/html/api/rebuild.html
deps/npm/html/api/restart.html
deps/npm/html/api/root.html
deps/npm/html/api/run-script.html
deps/npm/html/api/search.html
deps/npm/html/api/shrinkwrap.html
deps/npm/html/api/start.html
deps/npm/html/api/stop.html
deps/npm/html/api/submodule.html
deps/npm/html/api/tag.html
deps/npm/html/api/test.html
deps/npm/html/api/uninstall.html
deps/npm/html/api/unpublish.html
deps/npm/html/api/update.html
deps/npm/html/api/version.html
deps/npm/html/api/view.html
deps/npm/html/api/whoami.html
deps/npm/html/doc/README.html
deps/npm/html/doc/adduser.html
deps/npm/html/doc/bin.html
deps/npm/html/doc/bugs.html
deps/npm/html/doc/build.html
deps/npm/html/doc/bundle.html
deps/npm/html/doc/cache.html
deps/npm/html/doc/changelog.html
deps/npm/html/doc/coding-style.html
deps/npm/html/doc/completion.html
deps/npm/html/doc/config.html
deps/npm/html/doc/deprecate.html
deps/npm/html/doc/developers.html
deps/npm/html/doc/disputes.html
deps/npm/html/doc/docs.html
deps/npm/html/doc/edit.html
deps/npm/html/doc/explore.html
deps/npm/html/doc/faq.html
deps/npm/html/doc/folders.html
deps/npm/html/doc/help-search.html
deps/npm/html/doc/help.html
deps/npm/html/doc/index.html
deps/npm/html/doc/init.html
deps/npm/html/doc/install.html
deps/npm/html/doc/json.html
deps/npm/html/doc/link.html
deps/npm/html/doc/list.html
deps/npm/html/doc/npm.html
deps/npm/html/doc/outdated.html
deps/npm/html/doc/owner.html
deps/npm/html/doc/pack.html
deps/npm/html/doc/prefix.html
deps/npm/html/doc/prune.html
deps/npm/html/doc/publish.html
deps/npm/html/doc/rebuild.html
deps/npm/html/doc/registry.html
deps/npm/html/doc/removing-npm.html
deps/npm/html/doc/restart.html
deps/npm/html/doc/root.html
deps/npm/html/doc/run-script.html
deps/npm/html/doc/scripts.html
deps/npm/html/doc/search.html
deps/npm/html/doc/semver.html
deps/npm/html/doc/shrinkwrap.html
deps/npm/html/doc/star.html
deps/npm/html/doc/start.html
deps/npm/html/doc/stop.html
deps/npm/html/doc/submodule.html
deps/npm/html/doc/tag.html
deps/npm/html/doc/test.html
deps/npm/html/doc/uninstall.html
deps/npm/html/doc/unpublish.html
deps/npm/html/doc/update.html
deps/npm/html/doc/version.html
deps/npm/html/doc/view.html
deps/npm/html/doc/whoami.html
deps/npm/man/man1/npm.1
deps/npm/man/man3/npm.3
deps/npm/package.json
doc/api/url.markdown
lib/http.js
src/node_version.h
test/simple/test-fs-sync-fd-leak.js
2012-05-04 15:12:47 -07:00
Ben Noordhuis
df2c5fa81d
fs: fix file descriptor leak in sync functions
...
Fixes #3202 . This is a back-port of commit 4e290e4
.
2012-05-03 02:49:36 +02:00
Ben Noordhuis
4e290e48b2
fs: fix file descriptor leak in sync functions
...
Fixes #3202 .
2012-05-03 01:08:46 +02:00
Ben Noordhuis
47d6a94656
fs: fix ReadStream / WriteStream double close bug
...
* Calling fs.ReadStream.destroy() or fs.WriteStream.destroy() twice would close
the file descriptor twice. That's bad because the file descriptor may have
been repurposed in the mean time.
* A bad value check in fs.ReadStream.prototype.destroy() would prevent a stream
created with fs.createReadStream({fd:0}) from getting closed.
2012-05-03 01:01:46 +02:00
isaacs
ecca7525cc
Merge remote-tracking branch 'ry/v0.6' into master
...
Conflicts:
AUTHORS
ChangeLog
LICENSE
Makefile
deps/http_parser/test.c
deps/npm/AUTHORS
deps/npm/html/api/bin.html
deps/npm/html/api/bugs.html
deps/npm/html/api/commands.html
deps/npm/html/api/config.html
deps/npm/html/api/deprecate.html
deps/npm/html/api/docs.html
deps/npm/html/api/edit.html
deps/npm/html/api/explore.html
deps/npm/html/api/help-search.html
deps/npm/html/api/init.html
deps/npm/html/api/install.html
deps/npm/html/api/link.html
deps/npm/html/api/load.html
deps/npm/html/api/ls.html
deps/npm/html/api/npm.html
deps/npm/html/api/outdated.html
deps/npm/html/api/owner.html
deps/npm/html/api/pack.html
deps/npm/html/api/prefix.html
deps/npm/html/api/prune.html
deps/npm/html/api/publish.html
deps/npm/html/api/rebuild.html
deps/npm/html/api/restart.html
deps/npm/html/api/root.html
deps/npm/html/api/run-script.html
deps/npm/html/api/search.html
deps/npm/html/api/shrinkwrap.html
deps/npm/html/api/start.html
deps/npm/html/api/stop.html
deps/npm/html/api/submodule.html
deps/npm/html/api/tag.html
deps/npm/html/api/test.html
deps/npm/html/api/uninstall.html
deps/npm/html/api/unpublish.html
deps/npm/html/api/update.html
deps/npm/html/api/version.html
deps/npm/html/api/view.html
deps/npm/html/api/whoami.html
deps/npm/html/doc/README.html
deps/npm/html/doc/adduser.html
deps/npm/html/doc/bin.html
deps/npm/html/doc/bugs.html
deps/npm/html/doc/build.html
deps/npm/html/doc/bundle.html
deps/npm/html/doc/cache.html
deps/npm/html/doc/changelog.html
deps/npm/html/doc/coding-style.html
deps/npm/html/doc/completion.html
deps/npm/html/doc/config.html
deps/npm/html/doc/deprecate.html
deps/npm/html/doc/developers.html
deps/npm/html/doc/disputes.html
deps/npm/html/doc/docs.html
deps/npm/html/doc/edit.html
deps/npm/html/doc/explore.html
deps/npm/html/doc/faq.html
deps/npm/html/doc/folders.html
deps/npm/html/doc/help-search.html
deps/npm/html/doc/help.html
deps/npm/html/doc/index.html
deps/npm/html/doc/init.html
deps/npm/html/doc/install.html
deps/npm/html/doc/json.html
deps/npm/html/doc/link.html
deps/npm/html/doc/list.html
deps/npm/html/doc/npm.html
deps/npm/html/doc/outdated.html
deps/npm/html/doc/owner.html
deps/npm/html/doc/pack.html
deps/npm/html/doc/prefix.html
deps/npm/html/doc/prune.html
deps/npm/html/doc/publish.html
deps/npm/html/doc/rebuild.html
deps/npm/html/doc/registry.html
deps/npm/html/doc/removing-npm.html
deps/npm/html/doc/restart.html
deps/npm/html/doc/root.html
deps/npm/html/doc/run-script.html
deps/npm/html/doc/scripts.html
deps/npm/html/doc/search.html
deps/npm/html/doc/semver.html
deps/npm/html/doc/shrinkwrap.html
deps/npm/html/doc/star.html
deps/npm/html/doc/start.html
deps/npm/html/doc/stop.html
deps/npm/html/doc/submodule.html
deps/npm/html/doc/tag.html
deps/npm/html/doc/test.html
deps/npm/html/doc/uninstall.html
deps/npm/html/doc/unpublish.html
deps/npm/html/doc/update.html
deps/npm/html/doc/version.html
deps/npm/html/doc/view.html
deps/npm/html/doc/whoami.html
deps/npm/lib/npm.js
deps/npm/man/man1/npm.1
deps/npm/man/man3/npm.3
deps/npm/node_modules/fstream-npm/fstream-npm.js
deps/npm/node_modules/fstream-npm/node_modules/fstream-ignore/package.json
deps/npm/node_modules/fstream-npm/package.json
deps/npm/node_modules/node-gyp/LICENSE
deps/npm/node_modules/node-gyp/lib/build.js
deps/npm/node_modules/node-gyp/lib/install.js
deps/npm/node_modules/node-gyp/node_modules/ansi/package.json
deps/npm/node_modules/node-gyp/node_modules/glob/package.json
deps/npm/node_modules/node-gyp/package.json
deps/npm/package.json
deps/uv/test/test-fs.c
deps/v8/src/regexp-macro-assembler-tracer.cc
deps/v8/src/version.cc
src/node_version.h
src/platform_sunos.cc
test/simple/test-net-write-after-close.js
wscript
2012-04-18 11:57:54 -07:00
isaacs
c75f71dd72
fs.WriteStream: Handle modifications to fs.open
...
If the fs.open method is modified via AOP-style extension, in between
the creation of an fs.WriteStream and the processing of its action
queue, then the test of whether or not the method === fs.open will fail,
because fs.open has been replaced.
The solution is to save a reference to fs.open on the stream itself when
the action is placed in the queue.
This fixes isaacs/node-graceful-fs#6 .
2012-04-09 09:03:00 -07:00
isaacs
06ada03ed9
fs.WriteStream: Handle modifications to fs.open
...
If the fs.open method is modified via AOP-style extension, in between
the creation of an fs.WriteStream and the processing of its action
queue, then the test of whether or not the method === fs.open will fail,
because fs.open has been replaced.
The solution is to save a reference to fs.open on the stream itself when
the action is placed in the queue.
This fixes isaacs/node-graceful-fs#6 .
2012-04-09 08:39:13 -07:00
isaacs
45b772d8cb
fs.readFile: Emit 'close' if we don't expect a close later
...
This fixes a regression introduced by 40b7302
2012-04-07 16:53:18 -07:00
Bert Belder
40b7302af8
fs.readFile: don't make the callback before the fd is closed
...
On Windows it is not possible to unlink() the read file in the callback.
This fixes #3051 . A test is included.
2012-04-06 03:13:56 +02:00
AJ ONeal
493a6bb19a
[ISSUE #2554 #2567 ] throw if fs args for 'start' or 'end' are strings
2012-02-27 14:18:51 -08:00
AJ ONeal
7f58d207f3
[ISSUE #2554 #2567 ] throw if fs args for 'start' or 'end' are strings
2012-02-27 14:17:09 -08:00
isaacs
0cdf85e28d
Lint all the JavaScripts.
2012-02-18 15:34:57 -08:00
isaacs
116835561d
Merge remote-tracking branch 'ry/v0.6'
...
Conflicts:
ChangeLog
deps/v8/src/version.cc
deps/v8/tools/gyp/v8.gyp
doc/about/index.html
doc/community/index.html
doc/index.html
doc/logos/index.html
doc/template.html
lib/path.js
lib/querystring.js
src/node_version.h
2012-02-06 15:43:21 -08:00
Christopher Jeffrey
f64989e63b
fs: fix ReadStream fails to read from existing fd
...
A ReadStream constructed from an existing file descriptor failed to start
reading automatically. Avoids a userspace call to ReadStream.prototype._read().
2012-02-04 22:14:58 +01:00
Ben Noordhuis
279e7e7341
fs: add O_EXCL support, exclusive open file
2012-01-31 14:29:32 +01:00
Ben Noordhuis
88b919ea56
fs, test: add file open mode tests
2012-01-31 14:29:27 +01:00
Maciej Małecki
e10ed097cb
path fs: move path.exists*
to fs.exists*
...
`path.exists*` functions show a deprecation warning and call functions
from `fs`. They should be removed later.
test: fix references to `path.exists*` in tests
test fs: add test for `fs.exists` and `fs.existsSync`
doc: reflect moving `path.exists*` to `fs`
2012-01-21 14:37:14 +01:00
Emerson Macedo
aa67b1f375
fs: add appendFile() and appendFileSync() functions
2012-01-05 21:39:57 +01:00
Igor Zinkovsky
d6bae2cb95
document mode argument for fs.symlink
2011-12-16 11:16:33 -08:00
Ben Noordhuis
b1b3dc62ff
fs: handle fractional or NaN ReadStream buffer size
...
Fixes #2320 .
2011-12-13 16:31:12 +01:00
Author: Igor Zinkovsky
1f16a7b6e5
Enable long paths on windows
2011-11-25 09:35:52 +01:00
isaacs
0ba78d5f36
Close #2166 Close the fd in lchmod
2011-11-22 14:00:48 -08:00
Benjamin Pasero
b1bb17fd2b
fs: fix fs.realpath on windows to return on error
2011-11-08 13:02:04 +01:00
Ben Noordhuis
04958e88a4
fs: make mkdir() call callback if mode is omitted
...
Fixes #2043 .
2011-11-08 12:48:09 +01:00
Ben Noordhuis
5fd012e67a
fs: don't use octal values, not allowed in strict mode
2011-11-04 13:10:07 +01:00
Ryan Dahl
a936768890
stdout and stderr are blocking when referring to regular files
...
Fixes message tests.
2011-11-03 13:27:33 -07:00
Ben Noordhuis
11d68eb3fc
fs: make mkdir() default to 0777 permissions
...
Fixes #1999 .
2011-11-03 09:37:23 +01:00
Ryan Dahl
7b4370e5f8
Fix test/pummel/test-watch-file.js
2011-10-12 16:19:46 -07:00
talltyler
10f97f9424
Fixing #1774 about issues when running node with --harmony_block_scoping v8 option
...
Fixes #1837 .
2011-10-08 04:33:10 +09:00
Colton Baker
87286cc737
Fixed a lot of jslint errors.
...
Fixes #1831
2011-10-05 18:51:06 -07:00
Igor Zinkovsky
66293f6e98
fix spelling
2011-09-23 09:20:15 -07:00
Igor Zinkovsky
8fe5712477
fs watcher binding
2011-09-22 22:32:33 -07:00
Thomas Shinnick
7dc2c492e9
fs: unguarded fs.watchFile cache statWatchers checking fixed
...
Use hasOwnProperty to check filepath cache; previous code could fail if
a filepath duplicated a chained property name.
Fixes #1637 .
2011-09-12 15:59:00 +09:00
Thomas Shinnick
e58c036c27
fs: add positioned file writing feature to fs.WriteStream
...
Patterned on same feature in ReadStream; a small bit of new code added
plus two refactorings of previous code; added two test files.
Fixes #1645 .
2011-09-12 14:57:49 +09:00
Thomas Shinnick
e4ebeb630e
fs: minor corrections from examining stream read positioning
...
Fix minor typos, one small refactor, and change emit() in a constructor
to a throw
2011-09-12 14:57:43 +09:00
Igor Zinkovsky
65e6ba9cce
Enable link, symlink, and readlink on windows
2011-09-08 12:52:08 -07:00
Daniel Pihlström
fa829b0fd3
convert nonbuffer data to string in fs.writeFile/Sync
...
Fixes #657 .
2011-07-23 23:56:08 +09:00
Yoshihiro Kikuchi
3c4c36068e
fs: added an argument check in fs.watchFile
...
Fixes #1324 .
2011-07-21 13:35:47 +02:00
Ryan Dahl
0a3fc1d9c8
Remove StatWatcher's dep on C++ EventEmitter
2011-07-19 01:23:50 -07:00
Jörn Horstmann
ff50310cc5
Fixed a typo in a comment: "realpatch" -> "realpath"
2011-07-04 19:40:23 +02:00
isaacs
3935adced0
GH-853 fs.lchown and fs.lchmod
2011-04-20 16:04:39 -07:00
isaacs
5cfac21852
GH-853 fs.fchmod and fs.fchown
2011-04-20 16:04:33 -07:00
Felix Geisendörfer
80711b0ff9
Feature: WriteStream#bytesWritten property
...
Implemented a new property for writable file streams that keeps track
of the bytes written (not queued). This helps when you are piping
another stream to a file, and would like to know how big the file is
without having to issue another stat call.
closes #930
2011-04-14 14:26:46 -07:00
Ryan Dahl
598792ba91
Merge branch 'v0.4'
...
Conflicts:
src/platform_sunos.cc
test/simple/test-os.js
2011-04-14 01:11:21 +00:00
Felix Geisendörfer
301f53c2aa
Allow omission of end option for range reads
...
Problem: Sometimes it is useful to read a file from a certain position
to it's end. The current implementation was already perfectly capable
of this, but decided to throw an error when the user tried to omit
the end option. The only way to do this, was to pass {end: Infinity}.
Solution: Automatically assume {end: Infinity} when omitted, and remove
the previous exception thrown. Also updated the docs.
closes #801 .
2011-04-13 09:46:28 -07:00
Ryan Dahl
bfa9db9dd6
Merge branch 'v0.4'
...
Conflicts:
src/node_version.h
test/simple/test-buffer.js
2011-04-03 23:42:56 -07:00
isaacs
e1a72f0e2e
Closes GH-535 Immediate pause/resume race condition
...
Calling resume() immediately after calling pause() would trigger
a race condition where it would try to read() from a file
descriptor that was already being read from, causing an EBADF
2011-04-01 17:40:19 -07:00
Jorge Chamorro Bieling
e7604b1ea7
Retain buffers in fs.read/write()
...
Closes GH-814.
Closes GH-827.
2011-03-28 15:28:55 -07:00
Ryan Dahl
247d880113
Merge branch 'v0.4'
...
Conflicts:
src/node_version.h
2011-03-14 17:45:15 -07:00
Ryan Dahl
55048cdf79
Update copyright headers
2011-03-14 17:37:05 -07:00
Ryan Dahl
fbe36a7ca9
Revert "Closes GH-85 Emit error rather than throwing."
...
This reverts commit f3d364122d
.
Landed in master instead.
2011-03-02 22:10:16 -08:00
isaacs
11a06fe1e4
Closes GH-85 Emit error rather than throwing.
...
Since "error" events will throw when unhandled anyhow, it makes no sense
to throw from an EventEmitter's method, especially for such a minor
misdemeanor as attempting to write to a non-writable stream.
2011-03-02 22:09:39 -08:00
Ben Noordhuis
1d5ff15a46
fs.utimes() and fs.futimes() support.
2011-03-02 20:35:45 -08:00
koichik
4e7c37b87c
Fix fs.WriteStream.end(data, [encoding]) throws TypeError
2011-03-01 10:49:20 -08:00
isaacs
f3d364122d
Closes GH-85 Emit error rather than throwing.
...
Since "error" events will throw when unhandled anyhow, it makes no sense
to throw from an EventEmitter's method, especially for such a minor
misdemeanor as attempting to write to a non-writable stream.
2011-02-27 17:08:14 -08:00
isaacs
8b9dbdad27
Closes GH-687 Don't read fs read stream if not open
2011-02-19 16:38:21 -08:00
Felix Geisendörfer
e56ee67e13
Refactor fs.open parameter handling
...
Improvements:
* Removes an unnecessary variable
* Avoids having two variables with the same name
* Avoids re-declaring an existing parameter
* Removes an unnecessary ternary operator
* Avoid an inline short-circuit expression for greater clarity.
2011-02-15 13:57:54 -08:00
Felix Geisendörfer
29b0dc4ec8
Fix: fs.open callback did not fire
...
Problem: Omitting the mode parameter causes the provided callback
parameter to never fire. This was originally fixed in 6078c37b
and
later broken in 5f2e9093
.
Solution: Overwriting the value of a parameter also overwrites the
reference in the arguments object. This patch works arround this
fact by not touching the mode parameter until a reference to the
callback has been established.
2011-02-15 13:50:59 -08:00
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
Ryan Dahl
1a5acd9850
API: readFileSync without encoding argument now returns a Buffer
...
Correctly load utf8 data; add a test test-fs-read-file-sync.js
2010-05-29 13:38:00 -07:00
Ryan Dahl
8840ce340d
Bugfix: fs.ReadStream.setEncoding
...
Improve test-fs-read-stream test.
2010-05-26 18:33:38 -07:00
Micheil Smith
d89de07758
Adding experimental support for fs.chown and fs.chownSync.
...
Notes:
- Currently only accepts numeric user and group ids.
- No tests, as tests depend on getpwuid and getgrgid.
- No documentation, as there is no tests and this is experimental.
2010-05-26 13:37:45 -07:00
Ryan Dahl
19f475c573
fs.ReadStream should emit Buffers
...
And do proper utf8 encoding.
2010-05-24 15:47:42 -07:00
Felix Geisendörfer
c93e0aaf06
Deprecate string interface for fs.read()
...
This patch makes buffers the preferred output for fs.read() and
fs.readSync(). The old string interface is still supported by
converting buffers to strings dynamically. This allows to remove the
C++ code for string handling which is also part of this patch.
2010-05-20 16:31:18 -07:00
Ryan Dahl
e84395ff8c
Revert "Deprecate string interface for fs.read()"
...
This reverts commit cbbf9e43d1
.
2010-05-20 16:11:33 -07:00
Felix Geisendörfer
cbbf9e43d1
Deprecate string interface for fs.read()
...
This patch makes buffers the preferred output for fs.read() and
fs.readSync(). The old string interface is still supported by
converting buffers to strings dynamically. This allows to remove the
C++ code for string handling which is also part of this patch.
2010-05-20 15:25:49 -07:00
isaacs
5b740c488f
Fix a leaking global
2010-05-20 09:38:25 -07:00
Felix Geisendörfer
c46cbe0de4
Deprecate string interface for fs.write()
...
This patch makes buffers the preferred input for fs.write() and
fs.writeSync(). The old string interface is still supported by
converting strings to buffers dynamically. This allows to remove the
C++ code for string handling which is also part of this patch.
2010-05-19 12:53:43 -07:00
Ryan Dahl
e232f09d38
fs.WriteStream.write should support buffer
...
Also re-adding the callback parameter.
2010-05-17 19:44:14 -07:00
Andrew Johnston
9599607065
Added posix fsync and fdatasync to fs module
2010-05-14 18:42:22 -07:00
Elijah Insua
976926376d
Handle empty files with fs.readFile
2010-05-13 12:42:17 -07:00
Ben Noordhuis
c6c77d535f
Support for fstat(2) through fs.fstat() and fs.fstatSync(). Added test cases, updated documentation.
2010-05-12 14:20:43 -07:00
isaacs
bc45adcffa
Add binding.close to fs.readFile
2010-05-07 13:17:57 -07:00
Tim Caswell
c07c601c3b
fs.readFile uses a buffer internally and will return the raw buffer if no encoding is specified.
2010-05-06 22:22:14 -07:00
Jonathan Knezek
82c8973dfa
Changed undefined pos to null to prevent hanging on SheevaPlug
2010-05-05 22:34:36 -07:00
Ryan Dahl
e7a1fa1293
fs.FileWriteStream -> fs.WriteStream, fs.FileReadStream -> fs.ReadStream
2010-04-27 18:52:16 -07:00
Felix Geisendörfer
c143cba590
Get rid of coupling for stdin
2010-04-27 18:02:30 -07:00
Felix Geisendörfer
f2212fa59d
Support for FileReadStream.setEncoding
2010-04-27 17:31:04 -07:00
Felix Geisendörfer
76f98c27de
Get rid of coupling for stdout
2010-04-27 17:27:34 -07:00
Ryan Dahl
f618551694
Remove callback argument to FileWriteStream.prototype.write
2010-04-27 17:26:10 -07:00
Brian Hammond
40820ec8d5
Leave pos as undefined to allow reads from unseekable files like /proc/x/smaps on Linux
2010-04-23 10:34:10 -07:00
Tim Caswell
62d9852c3d
Replace slow and broken for..in loops with faster for loops over the keys.
2010-04-12 10:34:35 -07:00
isaacs
57fbb627ca
trailing whitespace fixes
2010-04-11 14:48:23 -07:00
Ryan Dahl
50c70ac714
Update stream API: forceClose() -> destroy(), close() -> end()
2010-04-08 12:24:29 -07:00
Ryan Dahl
7faf7d5c8d
Put file stream methods into prototype, small style fixes
2010-04-08 11:26:26 -07:00
Ryan Dahl
3819920d77
Rename binding reference in fs.js
2010-04-08 11:26:26 -07:00
Johan Dahlberg
18de108e4c
Bugfix: watchFile, unwatch, watch causes error
...
Fixed bug that caused application to cast a "TypeError: Cannot call method
'addListener' of undefined" when first watching a file, unwatching and then
watching same file again.
2010-03-31 10:38:25 -07:00
Ryan Dahl
627fb5adbb
Load c++ modules on demand
2010-03-15 14:24:15 -07:00
Ryan Dahl
5c712a7da5
Lazy load fs.readFile
2010-03-15 10:41:58 -07:00
Ryan Dahl
4ccdc501d4
Include lib/ directory in node executable. Compile on demand.
...
Instead of installing the files in /usr/lib/node/libraries and loading them
from the file system, the files are built-in to the node executable.
However, they are only compiled on demand.
The reasoning is:
1. Allow for more complex internal javascript. In particular,
process.stdout and process.stdin can be js implemented streams.
2. Ease system installs. Loading from disk each time is unnecessary
overhead. Note that there is no "system" path for modules anymore. Only
$HOME/.node_libraries.
2010-03-15 08:04:35 -07:00
Ryan Dahl
6bd11f147a
Fix undefined reference in fs.js
2010-03-11 14:32:10 -08:00
Ryan Dahl
6d9227b79a
Make relative ref to sys in fs module.
2010-03-11 12:48:47 -08:00
isaacs
a38aa02f9f
Remove process.mixin dependency from fs
2010-03-08 17:57:08 -08:00
Felix Geisendörfer
39472709f0
fs.createWriteStream throws fs undefined error
...
The improved test suite now catches this bug, so hopefully thing like
this will not happen again.
See: http://github.com/ry/node/issues#issue/75
2010-03-08 10:22:19 -08:00
Felix Geisendörfer
9a9f08b1bc
Add callbacks to stream methods
...
Allows for more fine graining, especially finding out about an individual
chunk of data being flushed in a write stream rather than the whole queue.
This commit also fixes a bug causing forceClose to fail on a readStream that
did not finish opening yet.
2010-03-08 09:05:56 -08:00
Ryan Dahl
5217eda1ae
Merge remote branch 'felixge/file2'
2010-03-05 11:11:23 -08:00
Felix Geisendörfer
dbf9e466bc
Documentation for FileWriteStream
2010-03-05 20:04:19 +01:00
Felix Geisendörfer
78c61000c2
Properly handle read errors
...
Also set readable to false if the initial fs.open call failed.
2010-03-05 19:53:59 +01:00
Felix Geisendörfer
145fac2b56
Use sys inherits
...
Also use events.EventEmitter instead of process.EventEmitter.
2010-03-05 19:24:20 +01:00
Felix Geisendörfer
0fcc94525a
Renamed fileReadStream -> createReadStream
...
Did the same for fileWriteStream as well.
2010-03-05 18:56:25 +01:00
Felix Geisendörfer
48562fa938
Updated file streams
...
Read streams now only support forceClose()
Write streams support close() and forceClose()
2010-03-05 18:43:29 +01:00
Felix Geisendörfer
b4fba5fe8e
Simplify buffering
...
There is no way more than one read event would be buffered.
2010-03-05 18:43:29 +01:00
Felix Geisendörfer
f6e00759ef
Initial read stream implementation
2010-03-05 18:43:28 +01:00
Felix Geisendörfer
9415ca909e
Use process.mixin instead of sys.mixin
...
The process namespace has not been cleaned up yet, so mixin is still
attached to process.
2010-03-05 18:42:32 +01:00
Rasmus Andersson
5c602b750a
Rewrote realpath implementation solving all known failing tests (also added a bunch of new test cases)
2010-03-02 17:35:34 -08:00
Felix Geisendörfer
18a70ffda1
Tweaks
...
- Add 'writeable' property
- Renamed pump->flush
- Use sys.mixin instead of process.mixin
2010-03-02 23:29:54 +01:00
Felix Geisendörfer
61785afb3d
Initial write stream implementation
2010-03-02 23:29:54 +01:00
Rasmus Andersson
20d5963fae
Added fs.realpath and fs.realpathSync (pure javascript versions)
2010-03-01 19:14:24 -08:00
Ryan Dahl
30b700ee22
Move watchFile into fs module
2010-03-01 10:42:37 -08:00
Ryan Dahl
810882c1ad
Move 'fs' module out of src/node.js into its own file
2010-03-01 10:14:49 -08:00