Skip to content

Instantly share code, notes, and snippets.

/* START OF BLAKE2B CODE */
typedef uchar uint8_t;
typedef unsigned uint32_t;
typedef ulong uint64_t;
#ifdef BLAKE2_NO_INLINE
#define BLAKE2_LOCAL_INLINE(type) static type
#endif
'use strict'
const Command = require('ronin').Command
const utils = require('../../utils')
const debug = require('debug')
const log = debug('cli:version')
log.error = debug('cli:version:error')
const bs58 = require('bs58')
const fs = require('fs')
const async = require('async')
@nginnever
nginnever / get.js
Last active May 8, 2016 15:57
jsipfs files get cli
'use strict'
const Command = require('ronin').Command
const debug = require('debug')
const utils = require('../../utils')
const log = debug('cli:files')
log.error = debug('cli:files:error')
var fs = require('fs')
const path = require('path')
const pathExists = require('path-exists')
{
"_args": [
[
"ipfs-unixfs-engine",
"/Users/voxelot/Github/js-ipfs"
]
],
"_from": "ipfs-unixfs-engine@latest",
"_id": "[email protected]",
"_inCache": true,
function fileExporter (node, name, dir, callback) {
if (typeof dir === 'function') { callback = dir; dir = {} }
var rs = new Readable()
if (node.links.length === 0) {
const unmarshaledData = UnixFS.unmarshal(node.data)
rs.push(unmarshaledData.data)
rs.push(null)
ee.emit('file', { stream: rs, path: name, dir: dir })
callback()
} else {
'use strict'
const Command = require('ronin').Command
const IPFS = require('../../../core')
const debug = require('debug')
const log = debug('cli:version')
log.error = debug('cli:version:error')
const bs58 = require('bs58')
module.exports = Command.extend({
'use strict'
const defaultRepo = require('./default-repo')
const blocks = require('ipfs-blocks')
const BlockService = blocks.BlockService
const Block = blocks.Block
const mDAG = require('ipfs-merkle-dag')
const DAGNode = mDAG.DAGNode
const DAGService = mDAG.DAGService
const peerId = require('peer-id')
@nginnever
nginnever / CONTRIBUTING.md
Last active March 12, 2016 00:12
first shot

Contributing

Internationalization

IPFS WebUI has internationalization support, strings for translation can be marked by the i18n.t function. Example: <h3>Node Info</h3> becomes <h3>{i18n.t('Node Info')}</h3>. If you add a new string like this, be sure to add it to static/locale/webui-en.json as well, otherwise it would not be displayed in the UI. The same applies if you need to edit an existing string.

Our translation project is here: https://www.transifex.com/ipfs/ipfs/

@nginnever
nginnever / fixedsizedchunker.js
Created February 19, 2016 01:02
fixedSizedChunker Change
var through2 = require('through2')
exports = module.exports = FixedSizeChunker
// The difference of this chunker compared to other fixed size chunkers
// available, is that it doesn't add padding the last chunk
function FixedSizeChunker (size) {
var stream = through2(transform, flush)
@nginnever
nginnever / bufferStream.js
Created February 18, 2016 22:29
buffer to stream
const stream = require( "stream" )
const fileSystem = require( "fs" )
const util = require( "util" )
// turn the given source Buffer into a Readable stream.
function BufferStream(source) {
if (!Buffer.isBuffer(source)) {
throw(new Error("Source must be a buffer."))
}
// Super constructor.