|
@ -19,6 +19,12 @@ |
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
// Maintainers, keep in mind that octal literals are not allowed
|
|
|
|
|
|
// in strict mode. Use the decimal value and add a comment with
|
|
|
|
|
|
// the octal value. Example:
|
|
|
|
|
|
//
|
|
|
|
|
|
// var mode = 438; /* mode=0666 */
|
|
|
|
|
|
|
|
|
var util = require('util'); |
|
|
var util = require('util'); |
|
|
|
|
|
|
|
|
var binding = process.binding('fs'); |
|
|
var binding = process.binding('fs'); |
|
@ -110,7 +116,7 @@ fs.readFile = function(path, encoding_) { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
fs.readFileSync = function(path, encoding) { |
|
|
fs.readFileSync = function(path, encoding) { |
|
|
var fd = fs.openSync(path, constants.O_RDONLY, 0666); |
|
|
var fd = fs.openSync(path, constants.O_RDONLY, 438 /*=0666*/); |
|
|
var buffer = new Buffer(4048); |
|
|
var buffer = new Buffer(4048); |
|
|
var buffers = []; |
|
|
var buffers = []; |
|
|
var nread = 0; |
|
|
var nread = 0; |
|
@ -212,13 +218,13 @@ fs.open = function(path, flags, mode, callback) { |
|
|
callback = noop; |
|
|
callback = noop; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
mode = modeNum(mode, '0666'); |
|
|
mode = modeNum(mode, 438 /*=0666*/); |
|
|
|
|
|
|
|
|
binding.open(path, stringToFlags(flags), mode, callback); |
|
|
binding.open(path, stringToFlags(flags), mode, callback); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
fs.openSync = function(path, flags, mode) { |
|
|
fs.openSync = function(path, flags, mode) { |
|
|
mode = modeNum(mode, '0666'); |
|
|
mode = modeNum(mode, 438 /*=0666*/); |
|
|
return binding.open(path, stringToFlags(flags), mode); |
|
|
return binding.open(path, stringToFlags(flags), mode); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -565,7 +571,7 @@ fs.writeFile = function(path, data, encoding_, callback) { |
|
|
var encoding = (typeof(encoding_) == 'string' ? encoding_ : 'utf8'); |
|
|
var encoding = (typeof(encoding_) == 'string' ? encoding_ : 'utf8'); |
|
|
var callback_ = arguments[arguments.length - 1]; |
|
|
var callback_ = arguments[arguments.length - 1]; |
|
|
callback = (typeof(callback_) == 'function' ? callback_ : null); |
|
|
callback = (typeof(callback_) == 'function' ? callback_ : null); |
|
|
fs.open(path, 'w', 0666, function(openErr, fd) { |
|
|
fs.open(path, 'w', 438 /*=0666*/, function(openErr, fd) { |
|
|
if (openErr) { |
|
|
if (openErr) { |
|
|
if (callback) callback(openErr); |
|
|
if (callback) callback(openErr); |
|
|
} else { |
|
|
} else { |
|
@ -986,7 +992,7 @@ var ReadStream = fs.ReadStream = function(path, options) { |
|
|
this.paused = false; |
|
|
this.paused = false; |
|
|
|
|
|
|
|
|
this.flags = 'r'; |
|
|
this.flags = 'r'; |
|
|
this.mode = parseInt('0666', 8); |
|
|
this.mode = 438; /*=0666*/ |
|
|
this.bufferSize = 64 * 1024; |
|
|
this.bufferSize = 64 * 1024; |
|
|
|
|
|
|
|
|
options = options || {}; |
|
|
options = options || {}; |
|
@ -1175,7 +1181,7 @@ var WriteStream = fs.WriteStream = function(path, options) { |
|
|
|
|
|
|
|
|
this.flags = 'w'; |
|
|
this.flags = 'w'; |
|
|
this.encoding = 'binary'; |
|
|
this.encoding = 'binary'; |
|
|
this.mode = parseInt('0666', 8); |
|
|
this.mode = 438; /*=0666*/ |
|
|
this.bytesWritten = 0; |
|
|
this.bytesWritten = 0; |
|
|
|
|
|
|
|
|
options = options || {}; |
|
|
options = options || {}; |
|
|