formdata-node
Advanced tools
Comparing version 2.1.4 to 2.2.0
@@ -44,3 +44,3 @@ "use strict"; | ||
var _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _temp; | ||
var _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _temp; | ||
@@ -99,12 +99,2 @@ const { | ||
/** | ||
* Refers to the internal Readable stream | ||
* | ||
* @type {Readable} | ||
* | ||
* @public | ||
* @property | ||
* @readonly | ||
*/ | ||
/** | ||
* @type {string} | ||
@@ -145,7 +135,13 @@ * | ||
/** | ||
* @type AsyncIterableIterator<Buffer> | ||
* Refers to the internal Readable stream | ||
* | ||
* @private | ||
* @type {Readable} | ||
* | ||
* @public | ||
* @property | ||
* @readonly | ||
*/ | ||
get stream() { | ||
return Readable.from(this.__read()); | ||
} | ||
/** | ||
@@ -156,2 +152,4 @@ * Returns a string representation of the FormData | ||
*/ | ||
get [_Symbol$toStringTag]() { | ||
@@ -171,25 +169,7 @@ return "FormData"; | ||
(0, _initializerDefineProperty2.default)(this, "headers", _descriptor2, this); | ||
(0, _initializerDefineProperty2.default)(this, "stream", _descriptor3, this); | ||
(0, _initializerDefineProperty2.default)(this, "__carriage", _descriptor4, this); | ||
(0, _initializerDefineProperty2.default)(this, "__dashes", _descriptor5, this); | ||
(0, _initializerDefineProperty2.default)(this, "__footer", _descriptor6, this); | ||
(0, _initializerDefineProperty2.default)(this, "__defaultContentType", _descriptor7, this); | ||
(0, _initializerDefineProperty2.default)(this, "__content", _descriptor8, this); | ||
(0, _initializerDefineProperty2.default)(this, "__curr", _descriptor9, this); | ||
(0, _defineProperty2.default)(this, "__read", () => { | ||
const onFulfilled = ({ | ||
done, | ||
value | ||
}) => { | ||
if (done) { | ||
return this.stream.push(null); | ||
} | ||
this.stream.push(isBuffer(value) ? value : Buffer.from(String(value))); | ||
}; | ||
const onRejected = err => this.stream.emit("error", err); | ||
this.__curr.next().then(onFulfilled).catch(onRejected); | ||
}); | ||
(0, _initializerDefineProperty2.default)(this, "__carriage", _descriptor3, this); | ||
(0, _initializerDefineProperty2.default)(this, "__dashes", _descriptor4, this); | ||
(0, _initializerDefineProperty2.default)(this, "__footer", _descriptor5, this); | ||
(0, _initializerDefineProperty2.default)(this, "__defaultContentType", _descriptor6, this); | ||
(0, _initializerDefineProperty2.default)(this, "__content", _descriptor7, this); | ||
(0, _defineProperty2.default)(this, "inspect", this[inspect.custom]); | ||
@@ -291,2 +271,7 @@ | ||
async *__read() { | ||
for await (const ch of this.__getField()) { | ||
yield isBuffer(ch) ? ch : Buffer.from(String(ch)); | ||
} | ||
} | ||
/** | ||
@@ -302,2 +287,4 @@ * Append initial fields | ||
*/ | ||
__appendFromInitialFields(fields) { | ||
@@ -336,2 +323,5 @@ for (const field of fields) { | ||
__setField(name, value, filename, options, append, argsLength) { | ||
// TODO: Seems like a filename param is incorrect for Blobs | ||
// TODO: that are has a third arguments. | ||
// TODO: I need to fix that. | ||
const methodName = append ? "append" : "set"; | ||
@@ -428,7 +418,2 @@ | ||
let length = 0; | ||
if (this.__content.size === 0) { | ||
return length; | ||
} | ||
const carriageLength = Buffer.from(this.__carriage).length; | ||
@@ -701,3 +686,3 @@ | ||
} | ||
}), _descriptor3 = (0, _applyDecoratedDescriptor2.default)(_class.prototype, "stream", [_readOnly.default], { | ||
}), _descriptor3 = (0, _applyDecoratedDescriptor2.default)(_class.prototype, "__carriage", [_readOnly.default], { | ||
configurable: true, | ||
@@ -707,14 +692,5 @@ enumerable: true, | ||
initializer: function () { | ||
return new Readable({ | ||
read: () => this.__read() | ||
}); | ||
} | ||
}), _descriptor4 = (0, _applyDecoratedDescriptor2.default)(_class.prototype, "__carriage", [_readOnly.default], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: function () { | ||
return "\r\n"; | ||
} | ||
}), _descriptor5 = (0, _applyDecoratedDescriptor2.default)(_class.prototype, "__dashes", [_readOnly.default], { | ||
}), _descriptor4 = (0, _applyDecoratedDescriptor2.default)(_class.prototype, "__dashes", [_readOnly.default], { | ||
configurable: true, | ||
@@ -726,3 +702,3 @@ enumerable: true, | ||
} | ||
}), _descriptor6 = (0, _applyDecoratedDescriptor2.default)(_class.prototype, "__footer", [_readOnly.default], { | ||
}), _descriptor5 = (0, _applyDecoratedDescriptor2.default)(_class.prototype, "__footer", [_readOnly.default], { | ||
configurable: true, | ||
@@ -734,3 +710,3 @@ enumerable: true, | ||
} | ||
}), _descriptor7 = (0, _applyDecoratedDescriptor2.default)(_class.prototype, "__defaultContentType", [_readOnly.default], { | ||
}), _descriptor6 = (0, _applyDecoratedDescriptor2.default)(_class.prototype, "__defaultContentType", [_readOnly.default], { | ||
configurable: true, | ||
@@ -742,3 +718,3 @@ enumerable: true, | ||
} | ||
}), _descriptor8 = (0, _applyDecoratedDescriptor2.default)(_class.prototype, "__content", [_readOnly.default], { | ||
}), _descriptor7 = (0, _applyDecoratedDescriptor2.default)(_class.prototype, "__content", [_readOnly.default], { | ||
configurable: true, | ||
@@ -750,9 +726,2 @@ enumerable: true, | ||
} | ||
}), _descriptor9 = (0, _applyDecoratedDescriptor2.default)(_class.prototype, "__curr", [_readOnly.default], { | ||
configurable: true, | ||
enumerable: true, | ||
writable: true, | ||
initializer: function () { | ||
return this.__getField(); | ||
} | ||
})), _class); | ||
@@ -759,0 +728,0 @@ var _default = FormData; |
@@ -10,5 +10,4 @@ "use strict"; | ||
var nanoid = _interopRequireDefault(require("nanoid")); | ||
var _crypto = _interopRequireDefault(require("crypto")); | ||
const alpha = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; | ||
/** | ||
@@ -19,4 +18,4 @@ * @api private | ||
*/ | ||
const boundary = () => _crypto.default.randomBytes(16).toString("hex"); | ||
const boundary = (nanoid.default || nanoid).customAlphabet(alpha, 22); | ||
var _default = boundary; | ||
@@ -23,0 +22,0 @@ exports.default = _default; |
@@ -27,3 +27,3 @@ "use strict"; | ||
const isBlob = value => (0, _isObject.default)(value) && (0, _isString.default)(value.type) && (0, _isFunction.default)(value.arrayBuffer) && (0, _isFunction.default)(value.stream) && (0, _isFunction.default)(value.constructor) && names.includes(value.constructor.name) && "size" in value; | ||
const isBlob = value => (0, _isObject.default)(value) && (0, _isString.default)(value.type) && (0, _isFunction.default)(value.arrayBuffer) && (0, _isFunction.default)(value.stream) && (0, _isFunction.default)(value.constructor) && names.includes(value[Symbol.toStringTag] || value.constructor.name) && "size" in value; | ||
@@ -30,0 +30,0 @@ var _default = isBlob; |
{ | ||
"name": "formdata-node", | ||
"version": "2.1.4", | ||
"version": "2.2.0", | ||
"description": "FormData implementation for Node.js. Built over Readable stream and async generators.", | ||
@@ -15,3 +15,3 @@ "repository": "octet-stream/form-data", | ||
], | ||
"author": "Nick K. <nick.kruchinin@gmail.com>", | ||
"author": "Nick K. <io@octetstream.me>", | ||
"license": "MIT", | ||
@@ -21,3 +21,3 @@ "main": "lib/FormData", | ||
"engines": { | ||
"node": ">= 10.2.x" | ||
"node": ">= 10.17" | ||
}, | ||
@@ -39,10 +39,4 @@ "scripts": { | ||
"report": "npm run cleanup && npm run make:test && nyc npm run test && nyc report -r=html", | ||
"ci": "npm run make:test && nyc npm run test && npm run test:types && nyc report -r=lcov && codecov" | ||
"ci": "npm run make:test && nyc npm run test && nyc report -r=json" | ||
}, | ||
"ava": { | ||
"files": [ | ||
"test/**/*.js", | ||
"!test/__helper__/*.js" | ||
] | ||
}, | ||
"nyc": { | ||
@@ -58,20 +52,21 @@ "extension": [ | ||
"devDependencies": { | ||
"@babel/cli": "7.8.4", | ||
"@babel/core": "7.9.6", | ||
"@babel/plugin-proposal-class-properties": "7.8.3", | ||
"@babel/plugin-proposal-decorators": "7.8.3", | ||
"@babel/plugin-transform-modules-commonjs": "7.9.6", | ||
"@babel/plugin-transform-runtime": "7.9.6", | ||
"@babel/cli": "7.10.1", | ||
"@babel/core": "7.10.2", | ||
"@babel/plugin-proposal-class-properties": "7.10.1", | ||
"@babel/plugin-proposal-decorators": "7.10.1", | ||
"@babel/plugin-transform-modules-commonjs": "7.10.1", | ||
"@babel/plugin-transform-runtime": "7.10.1", | ||
"@octetstream/eslint-config": "4.0.0", | ||
"@types/node": "14.0.3", | ||
"@types/node": "14.0.11", | ||
"ava": "3.8.2", | ||
"babel-plugin-add-module-exports": "1.0.2", | ||
"codecov": "3.7.0", | ||
"eslint": "7.0.0", | ||
"eslint": "7.2.0", | ||
"eslint-plugin-ava": "10.3.0", | ||
"fetch-blob": "1.0.5", | ||
"fetch-blob": "1.0.6", | ||
"husky": "4.2.5", | ||
"lint-staged": "10.2.4", | ||
"lint-staged": "10.2.9", | ||
"lodash.isplainobject": "4.0.6", | ||
"nyc": "15.0.1", | ||
"nyc": "15.1.0", | ||
"object-deep-from-entries": "^0.3.0", | ||
"proxyquire": "2.1.3", | ||
@@ -86,6 +81,5 @@ "rimraf": "3.0.2", | ||
"dependencies": { | ||
"@babel/runtime": "7.9.6", | ||
"mime-types": "2.1.27", | ||
"nanoid": "3.1.9" | ||
"@babel/runtime": "7.10.2", | ||
"mime-types": "2.1.27" | ||
} | ||
} |
@@ -5,4 +5,6 @@ # FormData | ||
[![Build Status](https://travis-ci.org/octet-stream/form-data.svg?branch=master)](https://travis-ci.org/octet-stream/form-data) | ||
![CI](https://github.com/octet-stream/form-data/workflows/CI/badge.svg) | ||
[![Code Coverage](https://codecov.io/github/octet-stream/form-data/coverage.svg?branch=master)](https://codecov.io/github/octet-stream/form-data?branch=master) | ||
![ESLint](https://github.com/octet-stream/form-data/workflows/ESLint/badge.svg) | ||
![TypeScript typings](https://github.com/octet-stream/form-data/workflows/TypeScript%20typings/badge.svg) | ||
[![dependencies Status](https://david-dm.org/octet-stream/form-data/status.svg)](https://david-dm.org/octet-stream/form-data) | ||
@@ -9,0 +11,0 @@ [![devDependencies Status](https://david-dm.org/octet-stream/form-data/dev-status.svg)](https://david-dm.org/octet-stream/form-data?type=dev) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2
185
69440
26
1947
+ Added@babel/runtime@7.10.2(transitive)
- Removednanoid@3.1.9
- Removed@babel/runtime@7.9.6(transitive)
- Removednanoid@3.1.9(transitive)
Updated@babel/runtime@7.10.2