Skip to content

Commit

Permalink
fs: simplify constant decls
Browse files Browse the repository at this point in the history
PR-URL: #12644
Reviewed-By: Brian White <[email protected]>
  • Loading branch information
jasnell committed May 1, 2017
1 parent e2199e0 commit 08809f2
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions lib/internal/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ const Buffer = require('buffer').Buffer;
const Writable = require('stream').Writable;
const fs = require('fs');
const util = require('util');
const constants = process.binding('constants').fs;

const O_APPEND = constants.O_APPEND | 0;
const O_CREAT = constants.O_CREAT | 0;
const O_EXCL = constants.O_EXCL | 0;
const O_RDONLY = constants.O_RDONLY | 0;
const O_RDWR = constants.O_RDWR | 0;
const O_SYNC = constants.O_SYNC | 0;
const O_TRUNC = constants.O_TRUNC | 0;
const O_WRONLY = constants.O_WRONLY | 0;

const {
O_APPEND,
O_CREAT,
O_EXCL,
O_RDONLY,
O_RDWR,
O_SYNC,
O_TRUNC,
O_WRONLY
} = process.binding('constants').fs;

function assertEncoding(encoding) {
if (encoding && !Buffer.isEncoding(encoding)) {
Expand Down

0 comments on commit 08809f2

Please sign in to comment.