Using nodejs and ipfs-core, it works fine. However, when trying to add a file using ipfs-http-client (49.0.2) and specifying a mode and mtime, that information does not seem to be preserved. I am not sure how to work around this…
const test = async (ipfs) => {
const fileName = "test.txt";
const input = {
path: fileName,
content: "Lorem ipsum dolor sit amet",
mode: 0o631,
mtime: {
secs: 5000,
nsecs: 100,
},
};
const res = await ipfs.add(input);
console.log("add", res);
const cid = res.cid;
for await (const file of ipfs.ls(cid)) {
console.log(JSON.stringify(file));
}
};
const testIPFSCore = async () => {
const IPFS = require("ipfs-core");
const ipfs = await IPFS.create();
await test(ipfs);
};
const testIPFSClient = async () => {
const ipfsClient = require("ipfs-http-client");
const LOCAL_IPFS_SERVER = process.env.LOCAL_IPFS_SERVER;
let ipfs = new ipfsClient(LOCAL_IPFS_SERVER);
await test(ipfs);
};
testIPFSCore();
testIPFSClient();