Skip to content

Commit

Permalink
perf: use node: prefix to bypass require.cache call for builtins (#201
Browse files Browse the repository at this point in the history
)

* perf: use `node:` prefix to bypass require.cache call for builtins

See fastify/fastify-static#407

* docs: use `node:` prefix to bypass require.cache call for builtins
  • Loading branch information
Fdawgs authored Sep 10, 2023
1 parent a8d7bd4 commit 881694b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ Then, register the plugin as follows:
'use strict'

const fastify = require('fastify')({ logger: false })
const fs = require('fs')
const path = require('path')
const fs = require('node:fs')
const path = require('node:path')

fastify.register(require('@fastify/secure-session'), {
// the name of the attribute decorated on the request-object, defaults to 'session'
Expand Down Expand Up @@ -248,7 +248,7 @@ npx @fastify/secure-session > secret-key2
```

```js
const fs = require('fs')
const fs = require('node:fs')
const fastify = require('fastify')({ logger: false })

const key1 = fs.readFileSync(path.join(__dirname, 'secret-key1'))
Expand Down
6 changes: 3 additions & 3 deletions examples/simple/example.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict'

const fastify = require('fastify')({ logger: false })
const fs = require('fs')
const path = require('path')
const assert = require('assert')
const fs = require('node:fs')
const path = require('node:path')
const assert = require('node:assert')

fastify.register(require('../..'), {
key: fs.readFileSync(path.join(__dirname, 'example-key'))
Expand Down

0 comments on commit 881694b

Please sign in to comment.