Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@super-protocol/ctl",
"version": "0.14.4",
"version": "0.14.6",
"description": "A tool for publishing values in a secure and reliable way.",
"main": "./build/index.js",
"type": "commonjs",
Expand Down
13 changes: 5 additions & 8 deletions src/commands/filesDownload.addon.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { promises as fs } from 'fs';
import path from 'path';
import Printer from '../printer';
import { isCommandSupported } from '../services/uplinkSetupHelper';
import readResourceFileService from '../services/readResourceFile';
Expand All @@ -23,15 +23,12 @@ export default async (params: FilesDownloadParams): Promise<void> => {
`Resource type ${resource.type} is not supported, use StorageProvider type for this command`,
);

const localPath = preparePath(params.localDirectory).replace(/\/$/, '');
const exists = await fs.stat(localPath).catch(() => null);

if (!exists) {
await fs.mkdir(localPath, { recursive: true });
} else if (!exists.isDirectory()) {
throw new Error('localDirectory argument must be the path to a folder');
let localPath = preparePath(params.localDirectory).replace(/\/$/, '');
if (resource.filepath) {
localPath = path.join(localPath, resource.filepath);
}

Printer.print(`Downloading file to ${localPath}`);
try {
const { download } = await import('@super-protocol/sp-files-addon');
await download(resource, localPath, {
Expand Down
Loading