0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

146 Commits

Author SHA1 Message Date
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
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
7f58d207f3 [ISSUE #2554 #2567] throw if fs args for 'start' or 'end' are strings 2012-02-27 14:17:09 -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
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