Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ module.exports = function (path, opts, cb) {
if('function' == typeof opts)
cb = opts, opts = null
var flags = opts && opts.flags || 'w'
var mode = opts && opts.mode || 0666

const ownerReadWrite = fs.constants.S_IRUSR + fs.constants.S_IWUSR
const groupReadWrite = fs.constants.S_IRGRP + fs.constants.S_IWGRP
const otherReadWrite = fs.constants.S_IROTH + fs.constants.S_IWOTH
const defaultMode = ownerReadWrite + groupReadWrite + otherReadWrite

var mode = opts && opts.mode || defaultMode
var pos = 0
return function (read) {
fs.open(path, flags, mode, function (err, fd) {
Expand Down