ipfs / ipfs/kubo

CoreAPI: ObjectStat and DataSize

Open
#5,325 4 comments 1 reaction 0 assignees View on GitHub
kind/enhancement topic/core-api
Dominant language
Go
Stars
17.1k
Forks
3.2k
Avg merge
3d 18h
Merged PRs (30d)
11

Description

When trying to migrate data out of IPFS with the CoreAPI, I noticed that an [ObjectStat's](https://github.com/ipfs/go-ipfs/blob/4bca53e0c9b52b1e2a066aa21d1e05d44bffd1ac/core/coreapi/interface/object.go#L14) DataSize member, is the size for the object's entire data segment, not just the size of the raw data stored under the type/format.
For example, current UnixFS nodes storing the data "IPFS", will be larger than 4bytes.

I believe adding a .RawDataSize member, would be valuable, for people who wish to migrate data out of IPFS.
It would allow them to consider the data segment's raw/target data size, and make decisions based around it, when dealing with foreign filesystems. For example, when dealing with file allocation sizes on an external drive of another format, prior to calling Cat().

My current workaround seems suboptimal: [reference](https://github.com/djdv/go-ipfs/commit/6db3ef41149ecfb4680651f9edcad042fc057e81#diff-864dd5908401b70ccd37dcd44f2de8e1R275)

Ping @magik6k, @schomatis

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.