Skip to content

Commit 11f7656

Browse files
authored
Use readFileSync
As observed in nodejs/node#37583 this is a fair bit faster than the promises version.
1 parent 56171de commit 11f7656

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
var flowRemoveTypes = require('flow-remove-types')
2-
var { readFile } = require('fs').promises
2+
var { readFileSync } = require('fs')
33

44
module.exports = (regexp = /$^/, force) => {
55
return {
66
name: 'flow',
77
setup(build) {
88
build.onLoad({ filter: regexp }, async (args) => {
9-
const source = await readFile(args.path, 'utf8')
9+
const source = readFileSync(args.path, 'utf8')
1010
let output = source
1111
if (force) {
1212
output = flowRemoveTypes('// @flow\n' + source, { pretty: true })

0 commit comments

Comments
 (0)