mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-02-20 17:33:18 +00:00
Document resin/data-prefix
This commit is contained in:
parent
842336e61b
commit
725f0ce014
@ -1,11 +1,30 @@
|
||||
mkdirp = require('mkdirp')
|
||||
fsUtils = require('./fs-utils/fs-utils')
|
||||
|
||||
# @nodoc
|
||||
prefix = null
|
||||
|
||||
# Get current prefix
|
||||
#
|
||||
# @return {String} prefix
|
||||
#
|
||||
# @example Get prefix
|
||||
# prefix = resin.data.prefix.get()
|
||||
#
|
||||
exports.get = ->
|
||||
return prefix
|
||||
|
||||
# Set prefix
|
||||
#
|
||||
# @param {String} newPrefix new prefix
|
||||
# @param {Function} callback callback (error)
|
||||
#
|
||||
# @throw {Error} Will throw if prefix is not a valid path
|
||||
#
|
||||
# @example Set prefix
|
||||
# resin.data.prefix.set '/opt/resin', (error) ->
|
||||
# throw error if error?
|
||||
#
|
||||
exports.set = (newPrefix, callback) ->
|
||||
if not fsUtils.isValidPath(newPrefix)
|
||||
return callback?(new Error('Invalid path'))
|
||||
@ -15,5 +34,9 @@ exports.set = (newPrefix, callback) ->
|
||||
prefix = newPrefix
|
||||
return callback?()
|
||||
|
||||
# Clear prefix
|
||||
#
|
||||
# @example Clear prefix
|
||||
# resin.data.prefix.clear()
|
||||
exports.clear = ->
|
||||
prefix = null
|
||||
|
Loading…
x
Reference in New Issue
Block a user