Use import for tar
This commit is contained in:
parent
c0a2435cdb
commit
4acfc623b4
|
@ -18,7 +18,8 @@ import { join } from "path"
|
||||||
import env from "../../../environment"
|
import env from "../../../environment"
|
||||||
|
|
||||||
const uuid = require("uuid/v4")
|
const uuid = require("uuid/v4")
|
||||||
const tar = require("tar")
|
import tar from "tar"
|
||||||
|
|
||||||
const MemoryStream = require("memorystream")
|
const MemoryStream = require("memorystream")
|
||||||
|
|
||||||
interface DBDumpOpts {
|
interface DBDumpOpts {
|
||||||
|
@ -33,13 +34,14 @@ interface ExportOpts extends DBDumpOpts {
|
||||||
}
|
}
|
||||||
|
|
||||||
function tarFilesToTmp(tmpDir: string, files: string[]) {
|
function tarFilesToTmp(tmpDir: string, files: string[]) {
|
||||||
const exportFile = join(budibaseTempDir(), `${uuid()}.tar.gz`)
|
const fileName = `${uuid()}.tar.gz`
|
||||||
|
const exportFile = join(budibaseTempDir(), fileName)
|
||||||
tar.create(
|
tar.create(
|
||||||
{
|
{
|
||||||
sync: true,
|
sync: true,
|
||||||
gzip: true,
|
gzip: true,
|
||||||
file: exportFile,
|
file: exportFile,
|
||||||
recursive: true,
|
noDirRecurse: false,
|
||||||
cwd: tmpDir,
|
cwd: tmpDir,
|
||||||
},
|
},
|
||||||
files
|
files
|
||||||
|
@ -124,6 +126,7 @@ export async function exportApp(appId: string, config?: ExportOpts) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const downloadedPath = join(tmpPath, appPath)
|
const downloadedPath = join(tmpPath, appPath)
|
||||||
if (fs.existsSync(downloadedPath)) {
|
if (fs.existsSync(downloadedPath)) {
|
||||||
const allFiles = fs.readdirSync(downloadedPath)
|
const allFiles = fs.readdirSync(downloadedPath)
|
||||||
|
|
Loading…
Reference in New Issue