Skip to content

Commit

Permalink
perf: use node: prefix to bypass require.cache call for builtins
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Aug 30, 2023
1 parent 77dfb53 commit c45e7da
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Example of an `async` `await` call to `poppler.pdfToCairo()`, to convert only th
PDF file using stdout:

```js
const fs = require("fs");
const { writeFile } = require("node:fs/promises");
const { Poppler } = require("node-poppler");

const file = "test_document.pdf";
Expand All @@ -93,7 +93,7 @@ const options = {

const res = await poppler.pdfToCairo(file, undefined, options);
// pdfToCairo writes to stdout using binary encoding if pdfFile or singleFile options are used
await fs.writeFile("new_file.pdf", res, { encoding: "binary" });
await writeFile("new_file.pdf", res, { encoding: "binary" });
```

### poppler.pdfToHtml
Expand All @@ -118,10 +118,10 @@ poppler.pdfToHtml(file, undefined, options).then((res) => {
Example of calling `poppler.pdfToHtml()` with a promise chain, providing a Buffer as an input:

```js
const fs = require("fs");
const { readFileSync } = require("node:fs");
const { Poppler } = require("node-poppler");

const file = fs.readFileSync("test_document.pdf");
const file = readFileSync("test_document.pdf");
const poppler = new Poppler();
const options = {
firstPageToConvert: 1,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"author": "Frazer Smith <frazer.dev@outlook.com>",
"funding": "https://github.com/sponsors/Fdawgs",
"engines": {
"node": ">=14.0.0"
"node": ">=14.18.0"
},
"scripts": {
"build": "tsc && jsdoc2md src/index.js > API.md && npm run lint:prettier:fix",
Expand Down
2 changes: 1 addition & 1 deletion scripts/license-checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

"use strict";

const { promisify } = require("util");
const { promisify } = require("node:util");
const { init } = require("license-checker");
// @ts-ignore
const copyLeftLicenses = require("spdx-copyleft");
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";

const { execFile, spawn } = require("child_process");
const { promisify } = require("util");
const { execFile, spawn } = require("node:child_process");
const { promisify } = require("node:util");
const camelCase = require("camelcase");
const { lt } = require("semver");
const path = require("upath");
Expand Down
6 changes: 3 additions & 3 deletions src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

"use strict";

const { execFile } = require("child_process");
const { access, readFile, unlink } = require("fs/promises");
const { promisify } = require("util");
const { execFile } = require("node:child_process");
const { access, readFile, unlink } = require("node:fs/promises");
const { promisify } = require("node:util");
const { glob } = require("glob");
const { lt } = require("semver");
const path = require("upath");
Expand Down

0 comments on commit c45e7da

Please sign in to comment.