Skip to content

Commit

Permalink
fix: remove dupl check for typed arrays (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmywarting committed Feb 9, 2022
1 parent 625526e commit 81a296d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/index.js
Expand Up @@ -108,7 +108,7 @@ async function writeFileAsync (filename, data, options = {}) {
if (options.tmpfileCreated) {
await options.tmpfileCreated(tmpfile)
}
if (Buffer.isBuffer(data) || ArrayBuffer.isView(data)) {
if (ArrayBuffer.isView(data)) {
await promisify(fs.write)(fd, data, 0, data.length, 0)
} else if (data != null) {
await promisify(fs.write)(fd, String(data), 0, String(options.encoding || 'utf8'))
Expand Down Expand Up @@ -210,7 +210,7 @@ function writeFileSync (filename, data, options) {
if (options.tmpfileCreated) {
options.tmpfileCreated(tmpfile)
}
if (Buffer.isBuffer(data) || ArrayBuffer.isView(data)) {
if (ArrayBuffer.isView(data)) {
fs.writeSync(fd, data, 0, data.length, 0)
} else if (data != null) {
fs.writeSync(fd, String(data), 0, String(options.encoding || 'utf8'))
Expand Down

0 comments on commit 81a296d

Please sign in to comment.