question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Method for creating new directory object w/ set of links

See original GitHub issue

Given a list or iterable of {"Hash": CID, "Name": str} objects, it should be possible to create a new directory object using object.put without having to manually create the directory object in bytes, query the size of links, or recursively add single links to directories one at a time (creating intermediate objects). Not sure if I’m missing an API for how to do this, but it would be pretty helpful.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ntninjacommented, Aug 26, 2020

The recently added .dag.put would allow for this more easily… Except that it doesn’t expose the required format parameter in the implementation I just merged two days ago 🤦 .

(See its upstream docs for why: https://ipfs.io/ipns/docs.ipfs.io/reference/http/api/#api-v0-dag-put)

1reaction
ntninjacommented, Jul 13, 2020

Yeah, it probably won’t be hyper-fast. Unfortunately, there exists no HTTP API in IPFS to upload whole directories as lists of CIDs. (Since both .add and .tar.add [not implemented] requires one to include the file bodies to upload as well.) Maybe the relatively new .dag.import could be used but then we’d need to generate CAR (content-addressable archive) data.

If you need the extra performance, it’s probably best to do what @SupraSummus did and just generate the relevant UnixFS protobuf datastructures yourself (using .block.put). They are not overly complicated.

We really need a Python IPLD library to make this kind of stuff easier though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

New-Item (Microsoft.PowerShell.Management)
The New-Item cmdlet creates a new item and sets its value. The types of items that can be created depend on the location...
Read more >
Create Directory (CRTDIR) - IBM
The Create Directory (CRTDIR) command adds a new directory to the system. A directory is an object that contains the names of other...
Read more >
Creating and Reading Directories (The Java™ Tutorials ...
You can create a new directory by using the createDirectory(Path, FileAttribute<?>) method. If you don't specify any FileAttributes , the new directory will ......
Read more >
Symlink Tutorial in Linux – How to Create and Remove a ...
A symlink (also called a symbolic link) is a type of file in Linux that points to another file or a folder on...
Read more >
How to Create a Directory in PowerShell? - eduCBA
.net framework class and System.io. a directory object is used to create directories. The path and related links are created along with the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found