It's very important to note that any time you use the command line, you are using the globally installed module and any frozen or unfrozen files will be located inside
/usr/local/lib/node_modules/cryostore/icebox/frozen (or unfrozen) on a mac or unix based system (On windows idk, good luck you're on your own).
Anytime you use the in-code methods like cryo.importJS(......) this will affect the locally installed copy in your current project.
var cryo =// - imports a file from an arbitrary path into cryostore - //// - imported JSON files should be files produced by cryostore - //cryo// - takes a .js file and turns into JSON - //cryo// - takes a .json file and turns into .js - //cryo// - pulls out and returns data from a js (unfrozen) or json (frozen) file - //cryo// - removes a file by name from frozen or unfrozen - //cryo//- removes all files from the unfrozen (js) folder - //cryo//can replace 'js' with 'json' or leave the parameter empty entirely to clear all folders.
cryostore ls // lists frozen and unfrozen files cryostore list cryostore f test.js // freezes that file, js -> json cryostore freeze test.js cryostore u test.js // unfreezes that json file, json -> js cryostore unfreeze test.js cryostore x test.json // prints file data in the console cryostore x test.js cryostore excavate test.json cryostore excavate test.js cryostore i path/to/from/current/test.json // imports an existing file from somewhere into frozen/unfrozen cryostore i path/to/from/current/test.js cryostore import path/to/from/current/test.js cryostore r test.js cryostore r test.json cryostore remove test.js // removes a single file, test.js, from unfrozen cryostore remove test.json // removes a singel file, test.json, from frozen cryostore removeall // clears your icebox (frozen and unfrozen folders) cryostore removeall js // clears only your unfrozen (the one with the js files) folder cryostore removeall json // clears only your frozen (the one with the json files)folder NOTE: All uses of 'cryostore' can be replaced with shorthand 'cryo'.
Contains frozen and unfrozen folders. Frozen is the place where JS gets stored as JSON. Contains .frozen.json file, don't overwrite it. Unfrozen is the place where your frozen JSON gets stored as JS. Contains .unfrozen.json file, don't overwrite it.
Example using async:
Since node is asynchronous we can't just call:
var cryo =cryo// - takes a .js file and turns into JSON - //cryo
in succession. We could put the cryo.freeze call inside cryo.importJS callback, but this puts us in dangerous territory and can land us in callback hell.
Using async we can combine asynchronous funtions to only execute after the predecessors are done. Like so:
var cryo =var async =async
npm install async as well as add it to your package.json under dependencies to use the package, it's not included with standard node.js.
Could eventually also work with mongoDB, could be cool.
Check to make sure we're not over writing files, add - number indexes onto repeat files.
Add the ability to create modular divisions within code.
Hit me up on twitter at @yvanscher.