git ssb

2+

cel / scuttlebot.io



Tree: 6c7b45a1469f155c415f6439a7df55b9e4d6c522

Files: 6c7b45a1469f155c415f6439a7df55b9e4d6c522 / tmpl / apis / modules / ssb-ref.md

635 bytesRaw

ssb-ref

Check if a string is a valid ssb-reference.

var ref = require('ssb-ref')

// Check if a string is a valid ref
ref.isLink(str)

// Check if a string is a feed id
ref.isFeedId(str)

// Check if a string is a message id
ref.isMsgId(str)

// Check if a string is a blob id
ref.isBlobId(str)

// Get the type of the reference
ref.type(str) == 'feed'
ref.type(str) == 'msg'
ref.type(str) == 'blob'
ref.type('not-a-link') == false

// Extract a ref out of a url
// (Url-encoding is supported)
ref.extract(url)
 == '%pGzeEydYdHjKW1iIchR0Yumydsr3QSp8+FuYcwVwi8Q=.sha256'

View on Github

Built with git-ssb-web