diff --git a/examples/example-legacy.js b/examples/example-legacy.js index fe90b777..d26fe6bb 100644 --- a/examples/example-legacy.js +++ b/examples/example-legacy.js @@ -1,8 +1,8 @@ 'use strict' const fastify = require('fastify')() -const fs = require('fs') -const path = require('path') +const fs = require('node:fs') +const path = require('node:path') const pump = require('pump') const form = path.join(__dirname, '..', 'form.html') diff --git a/examples/example.js b/examples/example.js index 4de2ecef..1ec2c4e4 100644 --- a/examples/example.js +++ b/examples/example.js @@ -1,10 +1,10 @@ 'use strict' const fastify = require('fastify')() -const fs = require('fs') -const util = require('util') -const path = require('path') -const { pipeline } = require('stream') +const fs = require('node:fs') +const util = require('node:util') +const path = require('node:path') +const { pipeline } = require('node:stream') const pump = util.promisify(pipeline) const form = path.join(__dirname, '..', 'form.html') diff --git a/index.js b/index.js index a56dea5c..18a22e56 100644 --- a/index.js +++ b/index.js @@ -1,18 +1,18 @@ 'use strict' const Busboy = require('@fastify/busboy') -const os = require('os') +const os = require('node:os') const fp = require('fastify-plugin') const eos = require('end-of-stream') -const { createWriteStream } = require('fs') -const { unlink } = require('fs').promises -const path = require('path') +const { createWriteStream } = require('node:fs') +const { unlink } = require('node:fs').promises +const path = require('node:path') const { generateId } = require('./lib/generateId') -const util = require('util') +const util = require('node:util') const createError = require('@fastify/error') const sendToWormhole = require('stream-wormhole') const deepmergeAll = require('@fastify/deepmerge')({ all: true }) -const { PassThrough, pipeline, Readable } = require('stream') +const { PassThrough, pipeline, Readable } = require('node:stream') const pump = util.promisify(pipeline) const secureJSON = require('secure-json-parse') diff --git a/test/big.test.js b/test/big.test.js index c96b161c..5770feee 100644 --- a/test/big.test.js +++ b/test/big.test.js @@ -4,11 +4,11 @@ const test = require('tap').test const FormData = require('form-data') const Fastify = require('fastify') const multipart = require('..') -const http = require('http') +const http = require('node:http') const stream = require('readable-stream') const Readable = stream.Readable const pump = stream.pipeline -const crypto = require('crypto') +const crypto = require('node:crypto') const sendToWormhole = require('stream-wormhole') // skipping on Github Actions because it takes too long diff --git a/test/fix-313.test.js b/test/fix-313.test.js index 31eb2624..12e15766 100644 --- a/test/fix-313.test.js +++ b/test/fix-313.test.js @@ -4,11 +4,11 @@ const test = require('tap').test const FormData = require('form-data') const Fastify = require('fastify') const multipart = require('..') -const http = require('http') -const path = require('path') -const fs = require('fs') -const { access } = require('fs').promises -const EventEmitter = require('events') +const http = require('node:http') +const path = require('node:path') +const fs = require('node:fs') +const { access } = require('node:fs').promises +const EventEmitter = require('node:events') const { once } = EventEmitter const filePath = path.join(__dirname, '../README.md') diff --git a/test/legacy/append-body.test.js b/test/legacy/append-body.test.js index e3a53c85..e5326432 100644 --- a/test/legacy/append-body.test.js +++ b/test/legacy/append-body.test.js @@ -3,9 +3,9 @@ const test = require('tap').test const FormData = require('form-data') const Fastify = require('fastify') const multipart = require('./../..') -const http = require('http') -const path = require('path') -const fs = require('fs') +const http = require('node:http') +const path = require('node:path') +const fs = require('node:fs') const pump = require('pump') const filePath = path.join(__dirname, '..', '..', 'README.md') diff --git a/test/legacy/big.test.js b/test/legacy/big.test.js index a585ba74..c5bff3b2 100644 --- a/test/legacy/big.test.js +++ b/test/legacy/big.test.js @@ -4,13 +4,13 @@ const test = require('tap').test const FormData = require('form-data') const Fastify = require('fastify') const multipart = require('./../..') -const http = require('http') +const http = require('node:http') const stream = require('readable-stream') const Readable = stream.Readable const Writable = stream.Writable const pump = stream.pipeline const eos = stream.finished -const crypto = require('crypto') +const crypto = require('node:crypto') // skipping on Github Actions because it takes too long test('should upload a big file in constant memory', { skip: process.env.CI }, function (t) { diff --git a/test/legacy/multipart.test.js b/test/legacy/multipart.test.js index 81c40ec7..5e76c113 100644 --- a/test/legacy/multipart.test.js +++ b/test/legacy/multipart.test.js @@ -1,12 +1,12 @@ 'use strict' -const os = require('os') +const os = require('node:os') const test = require('tap').test const FormData = require('form-data') const Fastify = require('fastify') const multipart = require('./../..') -const http = require('http') -const path = require('path') -const fs = require('fs') +const http = require('node:http') +const path = require('node:path') +const fs = require('node:fs') const concat = require('concat-stream') const stream = require('readable-stream') const pump = stream.pipeline diff --git a/test/multipart-ajv-file.test.js b/test/multipart-ajv-file.test.js index 2d27039f..6716ee3b 100644 --- a/test/multipart-ajv-file.test.js +++ b/test/multipart-ajv-file.test.js @@ -3,11 +3,11 @@ const test = require('tap').test const Fastify = require('fastify') const FormData = require('form-data') -const http = require('http') +const http = require('node:http') const multipart = require('..') -const { once } = require('events') -const fs = require('fs') -const path = require('path') +const { once } = require('node:events') +const fs = require('node:fs') +const path = require('node:path') const filePath = path.join(__dirname, '../README.md') diff --git a/test/multipart-attach-body.test.js b/test/multipart-attach-body.test.js index 207263a9..e4d45ac8 100644 --- a/test/multipart-attach-body.test.js +++ b/test/multipart-attach-body.test.js @@ -4,11 +4,11 @@ const test = require('tap').test const FormData = require('form-data') const Fastify = require('fastify') const multipart = require('..') -const http = require('http') -const path = require('path') -const fs = require('fs') -const { once } = require('events') -const { Readable } = require('stream') +const http = require('node:http') +const path = require('node:path') +const fs = require('node:fs') +const { once } = require('node:events') +const { Readable } = require('node:stream') const pump = require('pump') const { writableNoopStream } = require('noop-stream') diff --git a/test/multipart-big-stream.test.js b/test/multipart-big-stream.test.js index dc31972d..c77260f2 100644 --- a/test/multipart-big-stream.test.js +++ b/test/multipart-big-stream.test.js @@ -4,11 +4,11 @@ const test = require('tap').test const FormData = require('form-data') const Fastify = require('fastify') const multipart = require('..') -const http = require('http') -const crypto = require('crypto') +const http = require('node:http') +const crypto = require('node:crypto') const { Readable } = require('readable-stream') const sendToWormhole = require('stream-wormhole') -const EventEmitter = require('events') +const EventEmitter = require('node:events') const { once } = EventEmitter test('should emit fileSize limitation error during streaming', async function (t) { diff --git a/test/multipart-body-schema.test.js b/test/multipart-body-schema.test.js index d4e74fdf..edebc00a 100644 --- a/test/multipart-body-schema.test.js +++ b/test/multipart-body-schema.test.js @@ -4,9 +4,9 @@ const test = require('tap').test const FormData = require('form-data') const Fastify = require('fastify') const multipart = require('..') -const http = require('http') -const path = require('path') -const fs = require('fs') +const http = require('node:http') +const path = require('node:path') +const fs = require('node:fs') const filePath = path.join(__dirname, '../README.md') diff --git a/test/multipart-concat.test.js b/test/multipart-concat.test.js index 47c6ed74..912a1832 100644 --- a/test/multipart-concat.test.js +++ b/test/multipart-concat.test.js @@ -4,9 +4,9 @@ const test = require('tap').test const FormData = require('form-data') const Fastify = require('fastify') const multipart = require('..') -const http = require('http') -const path = require('path') -const fs = require('fs') +const http = require('node:http') +const path = require('node:path') +const fs = require('node:fs') const filePath = path.join(__dirname, '../README.md') diff --git a/test/multipart-disk.test.js b/test/multipart-disk.test.js index e471e31c..6eb61b34 100644 --- a/test/multipart-disk.test.js +++ b/test/multipart-disk.test.js @@ -4,13 +4,13 @@ const test = require('tap').test const FormData = require('form-data') const Fastify = require('fastify') const multipart = require('..') -const http = require('http') -const crypto = require('crypto') +const http = require('node:http') +const crypto = require('node:crypto') const { Readable } = require('readable-stream') -const path = require('path') -const fs = require('fs') -const { access } = require('fs').promises -const EventEmitter = require('events') +const path = require('node:path') +const fs = require('node:fs') +const { access } = require('node:fs').promises +const EventEmitter = require('node:events') const { once } = EventEmitter const filePath = path.join(__dirname, '../README.md') diff --git a/test/multipart-duplicate-save-request-file.test.js b/test/multipart-duplicate-save-request-file.test.js index cbccaedd..18cc9454 100644 --- a/test/multipart-duplicate-save-request-file.test.js +++ b/test/multipart-duplicate-save-request-file.test.js @@ -4,10 +4,10 @@ const test = require('tap').test const FormData = require('form-data') const Fastify = require('fastify') const multipart = require('..') -const http = require('http') -const path = require('path') -const fs = require('fs') -const EventEmitter = require('events') +const http = require('node:http') +const path = require('node:path') +const fs = require('node:fs') +const EventEmitter = require('node:events') const { once } = EventEmitter const filePath = path.join(__dirname, '../README.md') diff --git a/test/multipart-empty-body.test.js b/test/multipart-empty-body.test.js index cc818d7c..f0fbdfde 100644 --- a/test/multipart-empty-body.test.js +++ b/test/multipart-empty-body.test.js @@ -4,8 +4,8 @@ const test = require('tap').test const FormData = require('form-data') const Fastify = require('fastify') const multipart = require('..') -const http = require('http') -const { once } = require('events') +const http = require('node:http') +const { once } = require('node:events') test('should not break with a empty request body when attachFieldsToBody is true', async function (t) { t.plan(5) diff --git a/test/multipart-fileLimit.test.js b/test/multipart-fileLimit.test.js index 860e2728..3645503b 100644 --- a/test/multipart-fileLimit.test.js +++ b/test/multipart-fileLimit.test.js @@ -1,13 +1,13 @@ 'use strict' -const fs = require('fs') -const crypto = require('crypto') +const fs = require('node:fs') +const crypto = require('node:crypto') const test = require('tap').test const FormData = require('form-data') const Fastify = require('fastify') const multipart = require('..') -const http = require('http') -const EventEmitter = require('events') +const http = require('node:http') +const EventEmitter = require('node:events') const { once } = EventEmitter test('should throw fileSize limitation error when consuming the stream', async function (t) { diff --git a/test/multipart-http2.test.js b/test/multipart-http2.test.js index ae74fd85..832670d0 100644 --- a/test/multipart-http2.test.js +++ b/test/multipart-http2.test.js @@ -5,8 +5,8 @@ const FormData = require('form-data') const Fastify = require('fastify') const multipart = require('..') const h2url = require('h2url') -const path = require('path') -const fs = require('fs') +const path = require('node:path') +const fs = require('node:fs') const sendToWormhole = require('stream-wormhole') const filePath = path.join(__dirname, '../README.md') diff --git a/test/multipart-incomplete-upload.test.js b/test/multipart-incomplete-upload.test.js index 7ee33198..1d7a5907 100644 --- a/test/multipart-incomplete-upload.test.js +++ b/test/multipart-incomplete-upload.test.js @@ -1,14 +1,14 @@ 'use strict' -const util = require('util') +const util = require('node:util') const test = require('tap').test const FormData = require('form-data') const Fastify = require('fastify') const multipart = require('..') -const http = require('http') +const http = require('node:http') const sleep = util.promisify(setTimeout) const { writableNoopStream } = require('noop-stream') -const stream = require('stream') +const stream = require('node:stream') const pipeline = util.promisify(stream.pipeline) test('should finish with error on partial upload', async function (t) { diff --git a/test/multipart-json.test.js b/test/multipart-json.test.js index 3e78e32c..57c6f9c1 100644 --- a/test/multipart-json.test.js +++ b/test/multipart-json.test.js @@ -4,7 +4,7 @@ const test = require('tap').test const FormData = require('form-data') const Fastify = require('fastify') const multipart = require('..') -const http = require('http') +const http = require('node:http') test('should parse JSON fields forms if content-type is set', function (t) { t.plan(5) diff --git a/test/multipart-security.test.js b/test/multipart-security.test.js index 320cde4f..17f44c68 100644 --- a/test/multipart-security.test.js +++ b/test/multipart-security.test.js @@ -4,11 +4,11 @@ const test = require('tap').test const FormData = require('form-data') const Fastify = require('fastify') const multipart = require('..') -const http = require('http') -const path = require('path') -const fs = require('fs') -const crypto = require('crypto') -const EventEmitter = require('events') +const http = require('node:http') +const path = require('node:path') +const fs = require('node:fs') +const crypto = require('node:crypto') +const EventEmitter = require('node:events') const { once } = EventEmitter const filePath = path.join(__dirname, '../README.md') diff --git a/test/multipart-small-stream.test.js b/test/multipart-small-stream.test.js index 70a0e3c5..958c4805 100644 --- a/test/multipart-small-stream.test.js +++ b/test/multipart-small-stream.test.js @@ -4,10 +4,10 @@ const test = require('tap').test const FormData = require('form-data') const Fastify = require('fastify') const multipart = require('..') -const http = require('http') -const path = require('path') -const fs = require('fs') -const EventEmitter = require('events') +const http = require('node:http') +const path = require('node:path') +const fs = require('node:fs') +const EventEmitter = require('node:events') const sendToWormhole = require('stream-wormhole') const { once } = EventEmitter diff --git a/test/multipart.test.js b/test/multipart.test.js index 98eab535..33d837ee 100644 --- a/test/multipart.test.js +++ b/test/multipart.test.js @@ -1,16 +1,16 @@ 'use strict' -const util = require('util') +const util = require('node:util') const test = require('tap').test const FormData = require('form-data') const Fastify = require('fastify') const multipart = require('..') -const http = require('http') -const path = require('path') -const fs = require('fs') +const http = require('node:http') +const path = require('node:path') +const fs = require('node:fs') const concat = require('concat-stream') -const stream = require('stream') -const { once } = require('events') +const stream = require('node:stream') +const { once } = require('node:events') const pump = util.promisify(stream.pipeline) const sendToWormhole = require('stream-wormhole') diff --git a/tester.js b/tester.js index 341ae33d..f3696ad9 100644 --- a/tester.js +++ b/tester.js @@ -1,7 +1,7 @@ 'use strict' -const http = require('http') -const Readable = require('stream').Readable +const http = require('node:http') +const Readable = require('node:stream').Readable const FormData = require('form-data') const pump = require('pump') const knownLength = 1024 * 1024 * 1024