IPFS bulk upload: error when using ipfs hash as value for content

I have an array of 1111 IPFS hashes that correlate to some NFT metadata that I am trying to bulk upload. Is it not possible to upload IPFS hashes as the value for content when using the deep index api? For reference, I am getting this in response when I try to view the path: Screen Shot 2021-12-17 at 1.49.26 PM

1 Like

There are size limitations now when uploading to an IPFS folder. You could upload maybe 5MB. But you should upload strings and not binary data if you want to upload ipfs hashes

I was testing it with just one hash as a string and was still getting those characters back

How does the code that you used looks like?

let axios = require("axios");

let ipfsArray = [];
let promises = [];

for (let i = 0; i < 1; i++) {
    promises.push(new Promise( (res, rej) => {
            path: `metadata/${i}.json`,
            content: "QmPhLLBESGKnwMmMoJ3NXrSxmbmA2QipaEDL4g1LsREFY9"
Promise.all(promises).then( () => {
            headers: {
                "X-API-KEY": 'API_KEY',
                "Content-Type": "application/json",
                "accept": "application/json"
    ).then( (res) => {
    .catch ( (error) => {

ok, what happens here is that it uploaded in the binary form, it considered that content is encoded in base64, the right data was uploaded, but it is in binary format

you could try to upload a json, or try the version of uploaded to IPFS from cloud functions (where you have more control on the type of the content): https://docs.moralis.io/moralis-server/cloud-code/cloud-functions#ipfs

Oh I have not seen that in the docs, thank you for the quick responses I really appreciate it!

If anyone else in the future is looking for the solution, I ended up loading the hashes to JSON files locally (code below) before bulk uploading. It’s a little buggy with very large arrays since I’m not the best with nodejs and just needed a quick fix, so tweak where needed obv…but it works!

const ipfsAPI = require('ipfs-api');
fs = require('fs');

const ipfs = ipfsAPI('ipfs.moralis.io', '2053', {protocol: 'https'})
 for (let i = 0; i < myHashArray.length; i++) {
    ipfs.files.get(myHashArray[i], function (err, files) {
        files.forEach((file) => {
          fs.writeFile(`${i+1}.json`, file.content.toString('utf8'), function (err) {
            if (err) return console.log(err);

Guys I am very new with coding, no prior knowledge. I was only following the youtube video to copy the process. I came across the following error on youtube regarding (Bulk Mint NFTs on OpenSea Using IPFS folders (ERC1155 Compliant)

TypeError: Cannot read properties of undefined (reading ‘toString’)
at ReadFileContext.callback (/Users/rujanisaras/Desktop/ipfs upload bulk/images.js:15:31)
at FSReqCallback.readFileAfterOpen [as oncomplete] (node:fs:314:13)
please suggest with steps, I really appreciate your help.

You can create another forum post. Or read similar forum posts, it looks like there is an undefined variable