I am attemping to upload an MP4 using the ipfs-core package in NodeJs. The file size is approx 25mb. I have no issue uploading the file using the ipfs cli, only when I attempt to do it using Node:
// IPFS.create() called well ahead of time when app starts
public storeContent(contentName: string): Observable<string> {
//Read file contents
const file = fs.readFileSync('JCOW.mp4', "utf-8");
// The initSubject produces the ipfs from IPFS.create()
return this.initSubject.pipe(
mergeMap(ipfs => ipfs.add(file)),
...
catchError(err => {
console.log("There was an issue storing content " + contentName + ": " + err);
throw new Error();
})
)
}
The catchError is always hit and outputs the following:
“There was an issue storing content SomeFileName: Error: Not a valid cid”.
This seems to only happen when I try and add the entire mp4 file. I can call toString() on it and grab the first 100k bytes and submit it and it appears to work, returning a valid CID.