Skip to content

Commit 1ba5ad6

Browse files
authored
chore: remove old api (#1152)
1 parent ff0e3cc commit 1ba5ad6

File tree

5 files changed

+8
-19
lines changed

5 files changed

+8
-19
lines changed

package-lock.json

+1-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@
9292
"json-stream": "^1.0.0",
9393
"lodash": "^4.17.21",
9494
"mime-types": "^2.1.35",
95-
"mkdirp": "^0.5.6",
9695
"query-string": "^7.1.3",
9796
"through2": "^4.0.2",
9897
"web-encoding": "^1.1.5",

src/helpers.ts

+3
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ export class CopySourceOptions {
136136
}
137137
}
138138

139+
/**
140+
* @deprecated use nodejs fs module
141+
*/
139142
export function removeDirAndFiles(dirPath: string, removeSelf = true) {
140143
if (removeSelf) {
141144
return fs.rmSync(dirPath, { recursive: true, force: true })

src/minio.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import * as Stream from 'node:stream'
2323
import async from 'async'
2424
import BlockStream2 from 'block-stream2'
2525
import _ from 'lodash'
26-
import mkdirp from 'mkdirp'
2726
import * as querystring from 'query-string'
2827
import { TextEncoder } from 'web-encoding'
2928
import Xml from 'xml'
@@ -997,9 +996,9 @@ export class Client {
997996
(result, cb) => {
998997
objStat = result
999998
// Create any missing top level directories.
1000-
mkdirp(path.dirname(filePath), cb)
999+
fs.mkdir(path.dirname(filePath), { recursive: true }, (err) => cb(err))
10011000
},
1002-
(ignore, cb) => {
1001+
(cb) => {
10031002
partFile = `${filePath}.${objStat.etag}.part.minio`
10041003
fs.stat(partFile, (e, stats) => {
10051004
var offset = 0

tests/functional/functional-tests.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import superagent from 'superagent'
3131
import * as uuid from 'uuid'
3232

3333
import { AssumeRoleProvider } from '../../src/AssumeRoleProvider.ts'
34-
import { CopyDestinationOptions, CopySourceOptions, DEFAULT_REGION, removeDirAndFiles } from '../../src/helpers.ts'
34+
import { CopyDestinationOptions, CopySourceOptions, DEFAULT_REGION } from '../../src/helpers.ts'
3535
import { getVersionId } from '../../src/internal/helper.ts'
3636
import * as minio from '../../src/minio.js'
3737

@@ -4136,7 +4136,7 @@ describe('functional tests', function () {
41364136

41374137
step('Clean up temp directory part files', (done) => {
41384138
if (isSplitSuccess) {
4139-
removeDirAndFiles(tmpSubDir)
4139+
fs.rmdirSync(tmpSubDir)
41404140
}
41414141
done()
41424142
})

0 commit comments

Comments
 (0)