Skip to content

Commit 17df4e4

Browse files
committed
refactor: update package details and README for migration to pillarjs/send
- I also run the npm run lint:fix command
1 parent 2c5a5f2 commit 17df4e4

File tree

6 files changed

+57
-1373
lines changed

6 files changed

+57
-1373
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
matrix:
4646
os: [ubuntu-latest, windows-latest]
4747
# Node.js release schedule: https://nodejs.org/en/about/releases/
48-
node-version: [18, 19, 20, 21, 22, 23, 24, 25]
48+
node-version: [20, 21, 22, 23, 24, 25]
4949
steps:
5050
- uses: actions/checkout@v6
5151

@@ -62,7 +62,7 @@ jobs:
6262
run: npm install
6363

6464
- name: Run tests
65-
run: npm run test-ci
65+
run: npm run test:ci
6666

6767
- name: Upload code coverage
6868
uses: actions/upload-artifact@v5

LICENSE

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ MIT License
22

33
Copyright (c) 2012 TJ Holowaychuk
44
Copyright (c) 2014-2022 Douglas Christopher Wilson
5-
Copyright (c) 2023-present The Fastify team
6-
7-
The Fastify team members are listed at https://github.com/fastify/fastify#team.
5+
Copyright The Fastify Contributors.
6+
Copyright The Express Contributors.
87

98
Permission is hereby granted, free of charge, to any person obtaining a copy
109
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
# @fastify/send
1+
# send
22

3-
[![CI](https://github.com/fastify/send/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/fastify/send/actions/workflows/ci.yml)
4-
[![NPM version](https://img.shields.io/npm/v/@fastify/send.svg?style=flat)](https://www.npmjs.com/package/@fastify/send)
5-
[![neostandard javascript style](https://img.shields.io/badge/code_style-neostandard-brightgreen?style=flat)](https://github.com/neostandard/neostandard)
3+
[![NPM Version][npm-version-image]][npm-url]
4+
[![NPM Downloads][npm-downloads-image]][npm-url]
5+
[![CI][github-actions-ci-image]][github-actions-ci-url]
6+
[![Test Coverage][coveralls-image]][coveralls-url]
67

78
Send is a library for streaming files from the file system as an HTTP response
89
supporting partial responses (Ranges), conditional-GET negotiation (If-Match,
@@ -17,7 +18,7 @@ This is a [Node.js](https://nodejs.org/en/) module available through the
1718
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
1819

1920
```bash
20-
$ npm install @fastify/send
21+
$ npm install send
2122
```
2223

2324
### TypeScript
@@ -32,7 +33,7 @@ $ npm install -D @types/mime@3
3233
## API
3334

3435
```js
35-
const send = require('@fastify/send')
36+
const send = require('send')
3637
```
3738

3839
### send(req, path, [options])
@@ -208,7 +209,7 @@ given directory as the top-level. For example, a request
208209
```js
209210
const http = require('node:http')
210211
const parseUrl = require('parseurl')
211-
const send = require('@fastify/send')
212+
const send = require('send')
212213

213214
const server = http.createServer(async function onRequest (req, res) {
214215
const { statusCode, headers, stream } = await send(req, parseUrl(req).pathname, { root: '/www/public' })
@@ -224,7 +225,7 @@ server.listen(3000)
224225
```js
225226
const http = require('node:http')
226227
const parseUrl = require('parseurl')
227-
const send = require('@fastify/send')
228+
const send = require('send')
228229

229230
// Default unknown types to text/plain
230231
send.mime.default_type = 'text/plain'
@@ -252,7 +253,7 @@ custom function to render a listing of a directory.
252253
const http = require('node:http')
253254
const fs = require('node:fs')
254255
const parseUrl = require('parseurl')
255-
const send = require('@fastify/send')
256+
const send = require('send')
256257

257258
// Transfer arbitrary files from within /www/example.com/public/*
258259
// with a custom handler for directory listing
@@ -278,7 +279,7 @@ server.listen(3000)
278279
```js
279280
const http = require('node:http')
280281
const parseUrl = require('parseurl')
281-
const send = require('@fastify/send')
282+
const send = require('send')
282283

283284
const server = http.createServer(async function onRequest (req, res) {
284285
// transfer arbitrary files from within
@@ -314,4 +315,14 @@ server.listen(3000)
314315
315316
## License
316317
317-
Licensed under [MIT](./LICENSE).
318+
[MIT](LICENSE)
319+
320+
[coveralls-image]: https://badgen.net/coveralls/c/github/pillarjs/send/master
321+
[coveralls-url]: https://coveralls.io/r/pillarjs/send?branch=master
322+
[github-actions-ci-image]: https://badgen.net/github/checks/pillarjs/send/master?label=linux
323+
[github-actions-ci-url]: https://github.com/pillarjs/send/actions/workflows/ci.yml
324+
[node-image]: https://badgen.net/npm/node/send
325+
[node-url]: https://nodejs.org/en/download/
326+
[npm-downloads-image]: https://badgen.net/npm/dm/send
327+
[npm-url]: https://npmjs.org/package/send
328+
[npm-version-image]: https://badgen.net/npm/v/send

package.json

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "@fastify/send",
2+
"name": "send",
33
"description": "Better streaming static file server with Range and conditional-GET support",
4-
"version": "4.1.0",
4+
"version": "1.2.1",
55
"author": "TJ Holowaychuk <tj@vision-media.ca>",
66
"contributors": [
77
"Douglas Christopher Wilson <doug@somethingdoug.com>",
@@ -24,25 +24,25 @@
2424
"main": "index.js",
2525
"type": "commonjs",
2626
"types": "types/index.d.ts",
27+
"files": [
28+
"LICENSE",
29+
"index.js",
30+
"lib/",
31+
"types"
32+
],
2733
"license": "MIT",
2834
"repository": {
2935
"type": "git",
30-
"url": "git+https://github.com/fastify/send.git"
36+
"url": "git+https://github.com/pillarjs/send.git"
3137
},
3238
"bugs": {
33-
"url": "https://github.com/fastify/send/issues"
39+
"url": "https://github.com/pillarjs/send/issues"
40+
},
41+
"homepage": "https://github.com/pillarjs/send#readme",
42+
"funding": {
43+
"type": "opencollective",
44+
"url": "https://opencollective.com/express"
3445
},
35-
"homepage": "https://github.com/fastify/send#readme",
36-
"funding": [
37-
{
38-
"type": "github",
39-
"url": "https://github.com/sponsors/fastify"
40-
},
41-
{
42-
"type": "opencollective",
43-
"url": "https://opencollective.com/fastify"
44-
}
45-
],
4646
"keywords": [
4747
"static",
4848
"file",
@@ -69,8 +69,12 @@
6969
"lint": "eslint",
7070
"lint:fix": "eslint --fix",
7171
"test": "npm run test:unit && npm run test:typescript",
72+
"test:ci": "c8 --reporter=lcovonly --reporter=text npm test",
7273
"test:coverage": "c8 --reporter html node --test",
7374
"test:typescript": "tsd",
7475
"test:unit": "c8 --100 node --test"
76+
},
77+
"engines": {
78+
"node": ">= 18"
7579
}
7680
}

scripts/version-history.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use strict'
22

3-
var fs = require('fs')
4-
var path = require('path')
3+
const fs = require('fs')
4+
const path = require('path')
55

6-
var HISTORY_FILE_PATH = path.join(__dirname, '..', 'HISTORY.md')
7-
var MD_HEADER_REGEXP = /^====*$/
8-
var VERSION = process.env.npm_package_version
9-
var VERSION_PLACEHOLDER_REGEXP = /^(?:unreleased|(\d+\.)+x)$/
6+
const HISTORY_FILE_PATH = path.join(__dirname, '..', 'HISTORY.md')
7+
const MD_HEADER_REGEXP = /^====*$/
8+
const VERSION = process.env.npm_package_version
9+
const VERSION_PLACEHOLDER_REGEXP = /^(?:unreleased|(\d+\.)+x)$/
1010

11-
var historyFileLines = fs.readFileSync(HISTORY_FILE_PATH, 'utf-8').split('\n')
11+
const historyFileLines = fs.readFileSync(HISTORY_FILE_PATH, 'utf-8').split('\n')
1212

1313
if (!MD_HEADER_REGEXP.test(historyFileLines[1])) {
1414
console.error('Missing header in HISTORY.md')
@@ -21,7 +21,7 @@ if (!VERSION_PLACEHOLDER_REGEXP.test(historyFileLines[0])) {
2121
}
2222

2323
if (historyFileLines[0].indexOf('x') !== -1) {
24-
var versionCheckRegExp = new RegExp('^' + historyFileLines[0].replace('x', '.+') + '$')
24+
const versionCheckRegExp = new RegExp('^' + historyFileLines[0].replace('x', '.+') + '$')
2525

2626
if (!versionCheckRegExp.test(VERSION)) {
2727
console.error('Version %s does not match placeholder %s', VERSION, historyFileLines[0])
@@ -35,25 +35,25 @@ historyFileLines[1] = repeat('=', historyFileLines[0].length)
3535
fs.writeFileSync(HISTORY_FILE_PATH, historyFileLines.join('\n'))
3636

3737
function getLocaleDate () {
38-
var now = new Date()
38+
const now = new Date()
3939

4040
return zeroPad(now.getFullYear(), 4) + '-' +
4141
zeroPad(now.getMonth() + 1, 2) + '-' +
4242
zeroPad(now.getDate(), 2)
4343
}
4444

4545
function repeat (str, length) {
46-
var out = ''
46+
let out = ''
4747

48-
for (var i = 0; i < length; i++) {
48+
for (let i = 0; i < length; i++) {
4949
out += str
5050
}
5151

5252
return out
5353
}
5454

5555
function zeroPad (number, length) {
56-
var num = number.toString()
56+
let num = number.toString()
5757

5858
while (num.length < length) {
5959
num = '0' + num

0 commit comments

Comments
 (0)