-
Notifications
You must be signed in to change notification settings - Fork 384
Closed
Labels
api: storageIssues related to the googleapis/nodejs-storage API.Issues related to the googleapis/nodejs-storage API.priority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
Description
I have a local directory and I want to upload its contents to cloud storage, but when using transferManager.uploadManyFiles
with either the directory name, or array of files, the destination of the file in cloud storage is taken from the local file path.
local directory structure:
.
└── data
└── avatars
└── <image files>
here's my code
import { Storage, TransferManager } from "@google-cloud/storage";
const storage = new Storage();
const transferManager = new TransferManager(storage.bucket("bucket-name"));
const res = await transferManager.uploadManyFiles("data/avatars", {
prefix: "avatars",
passthroughOptions: {
destination: "", // ???
},
skipIfExists: true,
});
when uploaded with following code, it becomes
.
└── avatars
└── data
└── avatars
└── <image files>
the prefix property works, but I want to upload files directly to avatars/
there seem to be a passthroughOptions
that can take a destination, but when using uploadManyFiles
we don't know the exact file names, so can't make the full path
Shouldn't it be that while using prefix
, property, the local file path shouldn't be considered?
Metadata
Metadata
Assignees
Labels
api: storageIssues related to the googleapis/nodejs-storage API.Issues related to the googleapis/nodejs-storage API.priority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.‘Nice-to-have’ improvement, new feature or different behavior or design.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.