imp(middleware-multipart): replaced `fs.rmdirSync` with `rimraf.sync`
MODIFY
package.json
package.json
"@types/supertest": "^2.0.7",
"@typescript-eslint/eslint-plugin": "^1.7.0",
"@typescript-eslint/parser": "^1.7.0",
+ "@types/rimraf": "^2.0.2",
"eslint": "^5.16.0",
"husky": "^0.14.0",
"jest": "~23.6.0",

MODIFY
packages/middleware-multipart/src/specs/multipart.util.spec.ts
packages/middleware-multipart/src/specs/multipart.util.spec.ts
import * as fs from 'fs';
import * as path from 'path';
+import * as rimraf from 'rimraf';
import { createHttpRequest } from '@marblejs/core/dist/+internal/testing';
import { shouldParseFieldname, shouldParseMultipart, setRequestData, streamFileTo } from '../multipart.util';
import { FileIncomingData } from '../multipart.interface';
@@ -76,10 +77,10 @@ describe('#streamFileTo', async () => {
const savedFilePath = path.resolve(TMP_PATH, 'data_field');
const file = fs.createReadStream(uploadFilePath) as NodeJS.ReadableStream;
- afterEach(() => fs.rmdirSync(TMP_PATH));
+ afterEach(() => rimraf.sync(TMP_PATH));
test('streams file to given path ', async () => {
- if (fs.existsSync(TMP_PATH)) { fs.rmdirSync(TMP_PATH); }
+ if (fs.existsSync(TMP_PATH)) { rimraf.sync(TMP_PATH); }
const response = await from(streamFileTo(TMP_PATH)({
file,
@@ -112,7 +113,7 @@ describe('#streamFileTo', async () => {
test('creates folder if it doesn not exist ', async () => {
// given
- if (fs.existsSync(TMP_PATH)) { fs.rmdirSync(TMP_PATH); }
+ if (fs.existsSync(TMP_PATH)) { rimraf.sync(TMP_PATH); }
// when
streamFileTo(TMP_PATH);

MODIFY
yarn.lock
yarn.lock
dependencies:
"@types/node" "*"
+"@types/glob@*":
+ version "7.1.1"
+ resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.1.tgz#aa59a1c6e3fbc421e07ccd31a944c30eba521575"
+ integrity sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==
+ dependencies:
+ "@types/events" "*"
+ "@types/minimatch" "*"
+ "@types/node" "*"
+
"@types/jest@~23.3.10":
version "23.3.10"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-23.3.10.tgz#4897974cc317bf99d4fe6af1efa15957fa9c94de"
version "2.0.0"
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-2.0.0.tgz#5a7306e367c539b9f6543499de8dd519fac37a8b"
+"@types/minimatch@*":
+ version "3.0.3"
+ resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
+ integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==
+
"@types/node@*", "@types/node@^10.1.2":
version "10.12.12"
resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.12.tgz#e15a9d034d9210f00320ef718a50c4a799417c47"
resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.5.1.tgz#a38f69c62528d56ba7bd1f91335a8004988d72f7"
integrity sha512-mNhVdZHdtKHMMxbqzNK3RzkBcN1cux3AvuCYGTvjEIQT2uheH3eCAyYsbMbh2Bq8nXkeOWs1kyDiF7geWRFQ4Q==
+"@types/rimraf@^2.0.2":
+ version "2.0.2"
+ resolved "https://registry.yarnpkg.com/@types/rimraf/-/rimraf-2.0.2.tgz#7f0fc3cf0ff0ad2a99bb723ae1764f30acaf8b6e"
+ integrity sha512-Hm/bnWq0TCy7jmjeN5bKYij9vw5GrDFWME4IuxV08278NtU/VdGbzsBohcCUJ7+QMqmUq5hpRKB39HeQWJjztQ==
+ dependencies:
+ "@types/glob" "*"
+ "@types/node" "*"
+
"@types/superagent@*":
version "3.8.5"
resolved "https://registry.yarnpkg.com/@types/superagent/-/superagent-3.8.5.tgz#a8eb8ec5bce0234e50d6b8bee1941b5bb5686e2d"

imp(middleware-multipart): replaced `fs.rmdirSync` with `rimraf.sync`