diff --git a/README.md b/README.md
index 0492b72..236bcc0 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
[](https://github.com/fastify/send/actions/workflows/ci.yml)
[](https://www.npmjs.com/package/@fastify/send)
-[](https://standardjs.com/)
+[](https://github.com/neostandard/neostandard)
Send is a library for streaming files from the file system as an HTTP response
supporting partial responses (Ranges), conditional-GET negotiation (If-Match,
diff --git a/eslint.config.js b/eslint.config.js
new file mode 100644
index 0000000..89fd678
--- /dev/null
+++ b/eslint.config.js
@@ -0,0 +1,6 @@
+'use strict'
+
+module.exports = require('neostandard')({
+ ignores: require('neostandard').resolveIgnoresFromGitignore(),
+ ts: true
+})
diff --git a/package.json b/package.json
index 4a2e76c..6f16434 100644
--- a/package.json
+++ b/package.json
@@ -37,15 +37,14 @@
"@types/node": "^22.0.0",
"after": "0.8.2",
"benchmark": "^2.1.4",
- "snazzy": "^9.0.0",
- "standard": "^17.1.0",
+ "neostandard": "^0.11.9",
"supertest": "6.3.4",
"tap": "^21.0.0",
"tsd": "^0.31.0"
},
"scripts": {
- "lint": "standard | snazzy",
- "lint:fix": "standard --fix | snazzy",
+ "lint": "eslint",
+ "lint:fix": "eslint --fix",
"test": "npm run test:unit && npm run test:typescript",
"test:coverage": "tap --coverage-report=html",
"test:typescript": "tsd",
diff --git a/types/index.d.ts b/types/index.d.ts
index 76ff4e0..8231c1e 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -4,23 +4,23 @@
///
-import { Dirent } from "fs";
-import * as stream from "stream";
+import { Dirent } from 'fs'
+import * as stream from 'stream'
/**
* Create a new SendStream for the given path to send to a res.
* The req is the Node.js HTTP request and the path is a urlencoded path to send (urlencoded, not the actual file-system path).
*/
-declare function send(req: stream.Readable, path: string, options?: send.SendOptions): Promise;
+declare function send (req: stream.Readable, path: string, options?: send.SendOptions): Promise
-type Send = typeof send;
+type Send = typeof send
declare class Mime {
- constructor(typeMap: TypeMap, ...mimes: TypeMap[]);
+ constructor (typeMap: TypeMap, ...mimes: TypeMap[])
- getType(path: string): string | null;
- getExtension(mime: string): string | null;
- define(typeMap: TypeMap, force?: boolean): void;
+ getType (path: string): string | null
+ getExtension (mime: string): string | null
+ define (typeMap: TypeMap, force?: boolean): void
}
interface TypeMap {
@@ -28,8 +28,8 @@ interface TypeMap {
}
declare namespace send {
- export const mime: Mime;
- export const isUtf8MimeType: (value: string) => boolean;
+ export const mime: Mime
+ export const isUtf8MimeType: (value: string) => boolean
export interface SendOptions {
/**
@@ -59,7 +59,7 @@ declare namespace send {
* 'ignore' Pretend like the dotfile does not exist and 404.
* The default value is similar to 'ignore', with the exception that this default will not ignore the files within a directory that begins with a dot, for backward-compatibility.
*/
- dotfiles?: "allow" | "deny" | "ignore" | undefined;
+ dotfiles?: 'allow' | 'deny' | 'ignore' | undefined;
/**
* Byte offset at which the stream ends, defaults to the length of the file minus 1.
@@ -158,4 +158,4 @@ declare namespace send {
export { send as default }
}
-export = send;
+export = send
diff --git a/types/index.test-d.ts b/types/index.test-d.ts
index edb1329..1711484 100644
--- a/types/index.test-d.ts
+++ b/types/index.test-d.ts
@@ -1,11 +1,12 @@
-import { Dirent } from 'fs';
-import { Readable } from 'stream';
-import { expectType } from 'tsd';
-import send, { DirectorySendResult, ErrorSendResult, FileSendResult, SendResult } from '..';
+import { Dirent } from 'node:fs'
+import { resolve } from 'node:path'
+import { Readable } from 'node:stream'
+import { expectType } from 'tsd'
+import send, { DirectorySendResult, ErrorSendResult, FileSendResult, SendResult } from '..'
send.mime.define({
'application/x-my-type': ['x-mt', 'x-mtt']
-});
+})
expectType<(value: string) => boolean>(send.isUtf8MimeType)
expectType(send.isUtf8MimeType('application/json'))
@@ -18,8 +19,8 @@ const req: any = {}
maxContentRangeChunkSize: 10,
immutable: true,
maxAge: 0,
- root: __dirname + '/wwwroot'
- });
+ root: resolve(__dirname, '/wwwroot')
+ })
expectType(result)
expectType(result.statusCode)
@@ -28,7 +29,7 @@ const req: any = {}
}
{
- const result = await send(req, '/test.html', { contentType: true, maxAge: 0, root: __dirname + '/wwwroot' })
+ const result = await send(req, '/test.html', { contentType: true, maxAge: 0, root: resolve(__dirname, '/wwwroot') })
expectType(result)
expectType(result.statusCode)
@@ -37,7 +38,7 @@ const req: any = {}
}
{
- const result = await send(req, '/test.html', { contentType: false, root: __dirname + '/wwwroot' })
+ const result = await send(req, '/test.html', { contentType: false, root: resolve(__dirname, '/wwwroot') })
expectType(result)
expectType(result.statusCode)