Skip to content

Commit

Permalink
chore: remove old api (#1152)
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 authored May 18, 2023
1 parent ff0e3cc commit 1ba5ad6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 19 deletions.
14 changes: 1 addition & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
"json-stream": "^1.0.0",
"lodash": "^4.17.21",
"mime-types": "^2.1.35",
"mkdirp": "^0.5.6",
"query-string": "^7.1.3",
"through2": "^4.0.2",
"web-encoding": "^1.1.5",
Expand Down
3 changes: 3 additions & 0 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ export class CopySourceOptions {
}
}

/**
* @deprecated use nodejs fs module
*/
export function removeDirAndFiles(dirPath: string, removeSelf = true) {
if (removeSelf) {
return fs.rmSync(dirPath, { recursive: true, force: true })
Expand Down
5 changes: 2 additions & 3 deletions src/minio.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import * as Stream from 'node:stream'
import async from 'async'
import BlockStream2 from 'block-stream2'
import _ from 'lodash'
import mkdirp from 'mkdirp'
import * as querystring from 'query-string'
import { TextEncoder } from 'web-encoding'
import Xml from 'xml'
Expand Down Expand Up @@ -997,9 +996,9 @@ export class Client {
(result, cb) => {
objStat = result
// Create any missing top level directories.
mkdirp(path.dirname(filePath), cb)
fs.mkdir(path.dirname(filePath), { recursive: true }, (err) => cb(err))
},
(ignore, cb) => {
(cb) => {
partFile = `${filePath}.${objStat.etag}.part.minio`
fs.stat(partFile, (e, stats) => {
var offset = 0
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/functional-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import superagent from 'superagent'
import * as uuid from 'uuid'

import { AssumeRoleProvider } from '../../src/AssumeRoleProvider.ts'
import { CopyDestinationOptions, CopySourceOptions, DEFAULT_REGION, removeDirAndFiles } from '../../src/helpers.ts'
import { CopyDestinationOptions, CopySourceOptions, DEFAULT_REGION } from '../../src/helpers.ts'
import { getVersionId } from '../../src/internal/helper.ts'
import * as minio from '../../src/minio.js'

Expand Down Expand Up @@ -4136,7 +4136,7 @@ describe('functional tests', function () {

step('Clean up temp directory part files', (done) => {
if (isSplitSuccess) {
removeDirAndFiles(tmpSubDir)
fs.rmdirSync(tmpSubDir)
}
done()
})
Expand Down

0 comments on commit 1ba5ad6

Please sign in to comment.