Closed Delivator closed 4 years ago
Just like that?
@Delivator We can call it just once instead of twice. Can you do path = p.normalize(path)
at the beginning of the function and remove the two later calls to normalize
?
@Delivator I really like this option and I'll be adding it to the other SDKs. I'm thinking the option should be renamed though. People might confuse it with the Skynet root folder /var/skynet
. I'm thinking removeBaseDir
. Any ideas?
removeBaseDir
sounds great to me! 'Pushed those changes.
Hey @Delivator, we've been discussing this internally and we feel this should be the default behavior. It's only possible to upload one base directory at a time so the skylink should basically represent that directory. dir/file
should be predictably represented at <skylink>/file
. I think removeBaseDir
can be removed and this just becomes the new behavior. This way our SDKs will also be consistent with the web interface. What do you think? 🙂
Totally fine with this. I wasn't sure about compatibility but it makes sense to me!
It won't be compatible since developers might be making assumptions about the filepath in their code. We'll probably do a breaking change next time we publish.
Do you want to make this as the default behavior in this PR? Basically it just means removing the new variable.
Exactly! I'll merge this after https://github.com/NebulousLabs/nodejs-skynet/pull/29 is accepted, thanks for your contribution.
https://github.com/NebulousLabs/nodejs-skynet/pull/32/commits/08f60e0e90094e5b0a9d4244480bb19e72e7d864 broke all this again, on windows at least.
Because windows uses backslashes, in my example it now tries to remove dist/
from dist\js\chunk-vendors.36a8b4b3.js.map
which obviously does nothing, as such the skylink inclues the full path again.
Added
removeRootDir
toDefaultUploadOptions
which when enabled, strips the root directory from the filepaths on directory uploads. This is to have the same behavior as if we would upload using the webportal ui.Eg. using
skynet.UploadDirectory("./dist")
would upload files to<skylink>/dist/<subfiles>
, but when uploading directories using the web ui the path is<skylink>/<subfiles>
.So setting
removeRootDir
to true, replicates this behavior.