pinFromFS: More than one file and/or directory was provided for pinning
See original GitHub issueIn the README it is said that pinFromFS
works with directories but applying to ./dist
directory throws this error:
[16:31:03] Error: More than one file and/or directory was provided for pinning.
at /home/ilyaigpetrov/Projects/foobar-project/node_modules/@pinata/sdk/lib/pinata-sdk.js:22993:18
at processTicksAndRejections (internal/process/task_queues.js:86:5)
const pin = () => {
const pinataKey = process.env.PINATA_KEY;
const pinataSecret = process.env.PINATA_SECRET;
if (!pinataKey || !pinataSecret) {
throw new Error('PINATA_KEY and PINATA_SECRET env variables are required!');
}
const pinata = pinataSDK(pinataKey, pinataSecret);
const sourcePath = './dist';
const options = {
pinataMetadata: {
name: `foobar`,
keyvalues: {},
},
};
return pinata.pinFromFS(sourcePath).then((result) => {
console.log(result);
});
};
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:20 (3 by maintainers)
Top Results From Across the Web
Pin File or Directory - Pinata Docs
This endpoint will accept a single file or a single directory. The request must include a read stream for the payload in order...
Read more >Pinning 10000 images on IPFS with Pinata - Medium
This code reads the files from the img directory then pins them. Run the code: node scripts/pinToIPFS.js. Now head back to your Pinata...
Read more >Ask Question - Stack Overflow
When pinning a file within a folder to IPFS on pinata what determines the ... Is there a way to get all files...
Read more >@pinata/sdk - npm
{ id: This is Pinata's ID for the pin job, ipfsHash: This is the IPFS multi-hash provided to Pinata to pin, status: The...
Read more >How to pin files to IPFS using Pinata - Educative.io
Decentralization: IPFS stores content on multiple computers. When the user requests any file, one or more computers participating in IPFS provide that file....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ilyaigpetrov actually, neither slash version works with relative paths. If you use slash then you get “Invalid file path” error. If you use forward slash then you get “More than one file and/or directory was provided for pinning”.
And counter to my earlier comment, specifying the full path actually does not work correctly - least in the desired way. In the previous examples, “\Users\dir1\dir2\dir3” does not result in “dir3” being pinned but instead the entire path starting with “Users”. I can see how this could be desired based on the use case but it still is a situation where I haven’t been able to pin a directory without it having the same parent directory as the process pinning.
Sorry to rehash old issues but, I’m a little confused on the versioning scheme @obo20.
I installed the latest release initially, which is 1.1.23 (release in June of 2021).
Back in Feb 2020 you released this 1.1.4 which fixed this issue (but in a newer version than is currently released?).
Ran into this issue but found I need to change to 1.1.4 maybe (which is a technically older version but higher number).
I just need to upload a folder, which version should I use? I get this same error on Windows 10 with 1.1.23.