I use sdk "@pinata/sdk": "^2.1.0". The version has issues with pinFromFS. It does not work recursively. When directory has subdirectory, the command throws an error 'EISDIR: illegal operation on a directory, read'.
There is a problem with this logic ->
...
const files = await fs.promises.readdir(sourcePath);
const data = new NodeFormData();
files.forEach((file: string) => {
const filepath = path.join(sourcePath, file);
//for each file stream, we need to include the correct relative file path
data.append('file', fs.createReadStream(filepath), {
filepath: normalizePath(filepath)
});
});
...
I use sdk
"@pinata/sdk": "^2.1.0"
. The version has issues withpinFromFS
. It does not work recursively. When directory has subdirectory, the command throws an error 'EISDIR: illegal operation on a directory, read'. There is a problem with this logic ->SDK version 1.* did handle this properly