This repository has been archived by the owner on Mar 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 300
feat: support UnixFSv1.5 metadata #1186
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a8ca9d5
feat: support UnixFSv1.5 metadata
achingbrain 6a7e5c9
fix: expose new mfs functions
achingbrain 90758e1
refactor: send mtime and mode as headers instead of message parts
achingbrain bf755d2
fix: include headers for directories
achingbrain 65a6ec5
chore: update ipfs utils dep version
achingbrain dbb73e1
Merge remote-tracking branch 'origin/master' into support-unixfs-meta…
achingbrain efe07fd
chore: update ipfs-utils dep
achingbrain a20984c
Merge remote-tracking branch 'origin/master' into support-unixfs-meta…
achingbrain e55f92d
fix: stringify mode in browser
achingbrain 6885692
Merge remote-tracking branch 'origin/master' into support-unixfs-meta…
achingbrain 40d9699
Merge remote-tracking branch 'origin/master' into support-unixfs-meta…
achingbrain d34944e
test: add tests for unixfs metadata
achingbrain 0833e2e
fix: fix up tests etc for optional mtime
achingbrain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict' | ||
|
||
const configure = require('../lib/configure') | ||
const modeToString = require('../lib/mode-to-string') | ||
|
||
module.exports = configure(({ ky }) => { | ||
return function chmod (path, mode, options) { | ||
options = options || {} | ||
|
||
const searchParams = new URLSearchParams(options.searchParams) | ||
searchParams.append('arg', path) | ||
searchParams.append('mode', modeToString(mode)) | ||
if (options.format) searchParams.set('format', options.format) | ||
if (options.flush != null) searchParams.set('flush', options.flush) | ||
if (options.hashAlg) searchParams.set('hash', options.hashAlg) | ||
if (options.parents != null) searchParams.set('parents', options.parents) | ||
|
||
return ky.post('files/chmod', { | ||
timeout: options.timeout, | ||
signal: options.signal, | ||
headers: options.headers, | ||
searchParams | ||
}).text() | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict' | ||
|
||
const configure = require('../lib/configure') | ||
const mtimeToObject = require('../lib/mtime-to-object') | ||
|
||
module.exports = configure(({ ky }) => { | ||
return function touch (path, options) { | ||
options = options || {} | ||
const mtime = mtimeToObject(options.mtime) | ||
|
||
const searchParams = new URLSearchParams(options.searchParams) | ||
searchParams.append('arg', path) | ||
if (mtime) { | ||
searchParams.set('mtime', mtime.secs) | ||
searchParams.set('mtimeNsecs', mtime.nsecs) | ||
} | ||
if (options.format) searchParams.set('format', options.format) | ||
if (options.flush != null) searchParams.set('flush', options.flush) | ||
if (options.hashAlg) searchParams.set('hash', options.hashAlg) | ||
if (options.parents != null) searchParams.set('parents', options.parents) | ||
|
||
return ky.post('files/touch', { | ||
timeout: options.timeout, | ||
signal: options.signal, | ||
headers: options.headers, | ||
searchParams | ||
}).text() | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict' | ||
|
||
module.exports = (mode) => { | ||
if (mode === undefined || mode === null) { | ||
return undefined | ||
} | ||
|
||
if (typeof mode === 'string' || mode instanceof String) { | ||
return mode | ||
} | ||
|
||
return mode.toString(8).padStart(4, '0') | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is working...