formstream 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/History.md CHANGED
@@ -1,4 +1,23 @@
1
1
 
2
+ 1.2.0 / 2023-03-17
3
+ ==================
4
+
5
+ **features**
6
+ * [[`f268e86`](http://github.com/node-modules/formstream/commit/f268e86e6b55d5b981bb7daf9c8662bdcd820f5c)] - feat: Porting from new Buffer() to Buffer.from() (#22) (Matthew Speiser <<mattrspeiser@gmail.com>>)
7
+
8
+ **others**
9
+ * [[`3c09f70`](http://github.com/node-modules/formstream/commit/3c09f700b2440b8f391650c939d91c2d5e4ae9b3)] - test: run on github action (#21) (fengmk2 <<fengmk2@gmail.com>>)
10
+ * [[`2d5ed81`](http://github.com/node-modules/formstream/commit/2d5ed81e95b4fde270b5db2720fff0e19effd2dc)] - test: run test on node 12, 14, 16 (#20) (fengmk2 <<fengmk2@gmail.com>>)
11
+
12
+ 1.1.1 / 2021-04-28
13
+ ==================
14
+
15
+ **fixes**
16
+ * [[`c96ba5b`](http://github.com/node-modules/formstream/commit/c96ba5bace0e96bf39770769e43d9de4271971d8)] - fix: upgrade mime to fix wrong mime type (#19) (shaozj <<shaozj@users.noreply.github.com>>)
17
+
18
+ **others**
19
+ * [[`21918e5`](http://github.com/node-modules/formstream/commit/21918e5fc37a4cea5aae82659d39587f099e805b)] - chore: upgrade devDeps express to latest version (#15) (fengmk2 <<fengmk2@gmail.com>>)
20
+
2
21
  1.1.0 / 2016-12-19
3
22
  ==================
4
23
 
package/README.md CHANGED
@@ -1,19 +1,13 @@
1
1
  # formstream
2
2
 
3
3
  [![NPM version][npm-image]][npm-url]
4
- [![build status][travis-image]][travis-url]
5
4
  [![Test coverage][coveralls-image]][coveralls-url]
6
- [![David deps][david-image]][david-url]
7
5
  [![npm download][download-image]][download-url]
8
6
 
9
7
  [npm-image]: https://img.shields.io/npm/v/formstream.svg?style=flat-square
10
8
  [npm-url]: https://npmjs.org/package/formstream
11
- [travis-image]: https://img.shields.io/travis/node-modules/formstream.svg?style=flat-square
12
- [travis-url]: https://travis-ci.org/node-modules/formstream
13
9
  [coveralls-image]: https://img.shields.io/coveralls/node-modules/formstream.svg?style=flat-square
14
10
  [coveralls-url]: https://coveralls.io/r/node-modules/formstream?branch=master
15
- [david-image]: https://img.shields.io/david/node-modules/formstream.svg?style=flat-square
16
- [david-url]: https://david-dm.org/node-modules/formstream
17
11
  [download-image]: https://img.shields.io/npm/dm/formstream.svg?style=flat-square
18
12
  [download-url]: https://npmjs.org/package/formstream
19
13
 
package/lib/formstream.js CHANGED
@@ -33,7 +33,7 @@ var destroy = require('destroy');
33
33
 
34
34
  var PADDING = '--';
35
35
  var NEW_LINE = '\r\n';
36
- var NEW_LINE_BUFFER = new Buffer(NEW_LINE);
36
+ var NEW_LINE_BUFFER = Buffer.from(NEW_LINE);
37
37
 
38
38
  function FormStream() {
39
39
  if (!(this instanceof FormStream)) {
@@ -45,7 +45,7 @@ function FormStream() {
45
45
  this._boundary = this._generateBoundary();
46
46
  this._streams = [];
47
47
  this._buffers = [];
48
- this._endData = new Buffer(PADDING + this._boundary + PADDING + NEW_LINE);
48
+ this._endData = Buffer.from(PADDING + this._boundary + PADDING + NEW_LINE);
49
49
  this._contentLength = 0;
50
50
  this._isAllStreamSizeKnown = true;
51
51
  this._knownStreamSize = 0;
@@ -110,7 +110,7 @@ FormStream.prototype.headers = function (options) {
110
110
  };
111
111
 
112
112
  FormStream.prototype.file = function (name, filepath, filename, filesize) {
113
- var mimeType = mime.lookup(filepath);
113
+ var mimeType = mime.getType(filepath);
114
114
 
115
115
  if (typeof filename === 'number' && !filesize) {
116
116
  filesize = filename;
@@ -137,7 +137,7 @@ FormStream.prototype.field = function (name, value) {
137
137
  if (typeof value === 'number') {
138
138
  value = String(value);
139
139
  }
140
- value = new Buffer(value);
140
+ value = Buffer.from(value);
141
141
  }
142
142
  return this.buffer(name, value);
143
143
  };
@@ -145,9 +145,9 @@ FormStream.prototype.field = function (name, value) {
145
145
  FormStream.prototype.stream = function (name, stream, filename, mimeType, size) {
146
146
  if (typeof mimeType === 'number' && !size) {
147
147
  size = mimeType;
148
- mimeType = mime.lookup(filename);
148
+ mimeType = mime.getType(filename);
149
149
  } else if (!mimeType) {
150
- mimeType = mime.lookup(filename);
150
+ mimeType = mime.getType(filename);
151
151
  }
152
152
 
153
153
  stream.once('error', this.emit.bind(this, 'error'));
@@ -180,7 +180,7 @@ FormStream.prototype.stream = function (name, stream, filename, mimeType, size)
180
180
 
181
181
  FormStream.prototype.buffer = function (name, buffer, filename, mimeType) {
182
182
  if (filename && !mimeType) {
183
- mimeType = mime.lookup(filename);
183
+ mimeType = mime.getType(filename);
184
184
  }
185
185
 
186
186
  var disposition = { name: name };
@@ -222,7 +222,7 @@ FormStream.prototype._leading = function (disposition, type) {
222
222
  leading.push('');
223
223
  leading.push('');
224
224
 
225
- return new Buffer(leading.join(NEW_LINE));
225
+ return Buffer.from(leading.join(NEW_LINE));
226
226
  };
227
227
 
228
228
  FormStream.prototype._emitBuffers = function () {
package/package.json CHANGED
@@ -1,17 +1,16 @@
1
1
  {
2
2
  "name": "formstream",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "A multipart/form-data encoded stream, helper for file upload.",
5
5
  "main": "lib/formstream.js",
6
6
  "files": [
7
7
  "lib"
8
8
  ],
9
9
  "scripts": {
10
- "test": "mocha -R spec -t 5000 -r should test/*.test.js",
11
- "test-cov": "istanbul cover node_modules/.bin/_mocha -- -t 5000 -r should test/*.test.js",
12
- "test-travis": "istanbul cover node_modules/.bin/_mocha --report lcovonly -- -t 5000 -r should test/*.test.js",
13
- "jshint": "jshint .",
14
- "autod": "autod -w --prefix '^'"
10
+ "test": "egg-bin test",
11
+ "cov": "egg-bin cov",
12
+ "ci": "npm run lint && npm run cov",
13
+ "lint": "jshint ."
15
14
  },
16
15
  "repository": {
17
16
  "type": "git",
@@ -28,19 +27,18 @@
28
27
  ],
29
28
  "dependencies": {
30
29
  "destroy": "^1.0.4",
31
- "mime": "^1.3.4",
30
+ "mime": "^2.5.2",
32
31
  "pause-stream": "~0.0.11"
33
32
  },
34
33
  "devDependencies": {
35
- "autod": "*",
36
34
  "connect-multiparty": "1",
37
- "express": "4",
38
- "istanbul": "*",
39
- "mocha": "*",
35
+ "egg-bin": "^5.6.1",
36
+ "express": "^4.16.4",
37
+ "jshint": "^2.13.6",
40
38
  "pedding": "1",
41
39
  "should": "4",
42
40
  "urllib": "2"
43
41
  },
44
- "author": "fengmk2 <fengmk2@gmail.com> (http://fengmk2.github.com)",
42
+ "author": "fengmk2 <fengmk2@gmail.com> (https://github.com/fengmk2)",
45
43
  "license": "MIT"
46
44
  }