Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Add metadata support #63

Merged
merged 16 commits into from
Jan 9, 2020
Merged

Add metadata support #63

merged 16 commits into from
Jan 9, 2020

Conversation

achingbrain
Copy link
Collaborator

@achingbrain achingbrain commented Nov 21, 2019

Adds UnixFSv1.5 metadata support to mfs, including displaying it
when listing dirs and statting files.

Also adds `touch` and `chmod` commands to manipulate metadata in
a similar way to the unix shell.
@achingbrain achingbrain marked this pull request as ready for review November 27, 2019 14:51
Copy link

@alanshaw alanshaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also needs a PR to interface-ipfs-core to document the new commands.

src/cli/cp.js Outdated
@@ -18,7 +18,7 @@ module.exports = {
describe: 'Create any non-existent intermediate directories'
},
format: {
alias: 'h',
alias: 'f',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically a breaking change...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure - h was taken by another command so the short version of this option never worked before. More of a fix?

src/cli/mkdir.js Outdated
type: 'number',
default: true,
coerce: asOctal,
describe: 'Mtime to apply to the new directory'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, peeps probably want to use strings.

src/cli/touch.js Outdated
alias: 'm',
type: 'number',
default: parseInt(Date.now() / 1000),
describe: 'Time to use as the new modification time'
Copy link

@alanshaw alanshaw Dec 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
describe: 'Time to use as the new modification time'
describe: 'Time in seconds since the Unix epoch to use as the new modification time'

...or is it seconds?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's seconds in the spec.

src/core/chmod.js Outdated Show resolved Hide resolved
src/core/touch.js Outdated Show resolved Hide resolved

// persist mode & mtime if set previously
mode: (destination.unixfs && destination.unixfs.mode) || options.mode,
mtime: (destination.unixfs && destination.unixfs.mtime) ? parseInt(new Date() / 1000) : options.mtime
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the create flag is set and the file doesn't exist, can we set mtime and mode please?

Copy link
Collaborator Author

@achingbrain achingbrain Dec 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UnixFS entries get a default mode but not an mtime. I'll change it so it'll honour them if you pass them in.

@@ -8,7 +8,7 @@ const multihash = require('multihashes')
const createMfs = require('./helpers/create-mfs')
const cidAtPath = require('./helpers/cid-at-path')
const createShardedDirectory = require('./helpers/create-sharded-directory')
const all = require('async-iterator-all')
const all = require('it-all')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sooooo much nicer

@achingbrain achingbrain merged commit dc1144b into master Jan 9, 2020
@achingbrain achingbrain deleted the add-metadata-support branch January 9, 2020 14:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants