{"id":18265159,"url":"https://github.com/nasa-ammos/timecraftjs","last_synced_at":"2026-02-25T21:01:43.672Z","repository":{"id":50962306,"uuid":"212674023","full_name":"NASA-AMMOS/timecraftjs","owner":"NASA-AMMOS","description":"Time conversion using NAIF CSPICE Toolkit in JavaScript via Emscripten.","archived":false,"fork":false,"pushed_at":"2024-01-19T00:37:57.000Z","size":15298,"stargazers_count":7,"open_issues_count":10,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-02-06T11:25:27.140Z","etag":null,"topics":["conversion","cspice","emscripten","naif","naif-cspice","spice","time"],"latest_commit_sha":null,"homepage":"https://nasa-ammos.github.io/timecraftjs/example/","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NASA-AMMOS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-03T20:29:49.000Z","updated_at":"2024-05-15T18:14:23.000Z","dependencies_parsed_at":"2024-11-05T11:17:28.853Z","dependency_job_id":"9486dcd7-c432-43ab-9213-cdf52774e667","html_url":"https://github.com/NASA-AMMOS/timecraftjs","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/NASA-AMMOS/timecraftjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NASA-AMMOS%2Ftimecraftjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NASA-AMMOS%2Ftimecraftjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NASA-AMMOS%2Ftimecraftjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NASA-AMMOS%2Ftimecraftjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NASA-AMMOS","download_url":"https://codeload.github.com/NASA-AMMOS/timecraftjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NASA-AMMOS%2Ftimecraftjs/sbom","scorecard":{"id":97901,"data":{"date":"2025-08-11","repo":{"name":"github.com/NASA-AMMOS/timecraftjs","commit":"59d9477baa0ecd55d94426da82d7e556523275b7"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.1,"checks":[{"name":"Code-Review","score":7,"reason":"Found 3/4 approved changesets -- score normalized to 7","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/node.js.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/NASA-AMMOS/timecraftjs/node.js.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/NASA-AMMOS/timecraftjs/node.js.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/node.js.yml:28","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 29 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"30 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-v834-rhv4-65m3","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-15T09:28:37.532Z","repository_id":50962306,"created_at":"2025-08-15T09:28:37.532Z","updated_at":"2025-08-15T09:28:37.532Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29839927,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T20:42:33.054Z","status":"ssl_error","status_checked_at":"2026-02-25T20:42:21.322Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["conversion","cspice","emscripten","naif","naif-cspice","spice","time"],"created_at":"2024-11-05T11:17:19.220Z","updated_at":"2026-02-25T21:01:43.637Z","avatar_url":"https://github.com/NASA-AMMOS.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg\n    alt=\"TimeCraftJS\"\n    src=\"./images/logo.png\"\n    width=\"100\"\n  /\u003e\n\u003c/p\u003e\n\n# TimeCraftJS\n\n[![npm version](https://img.shields.io/npm/v/timecraftjs.svg?style=flat-square)](https://www.npmjs.com/package/timecraftjs)\n![Node.js CI](https://github.com/NASA-AMMOS/timecraftjs/workflows/Node.js%20CI/badge.svg)\n\n\u003c!--[![lgtm code quality](https://img.shields.io/lgtm/grade/javascript/g/NASA-AMMOS/timecraftjs.svg?style=flat-square\u0026label=code-quality)](https://lgtm.com/projects/g/NASA-AMMOS/timecraftjs/)--\u003e\n\nTimeCraftJS is a time conversion library that uses [NAIF's CSPICE](https://naif.jpl.nasa.gov/naif/). It exposes functions to execute operations to convert [SCET](https://en.wikipedia.org/wiki/Spacecraft_Event_Time), ET, SCT, furnish Kernels, among others, on the client side. This avoid unnecessary trips to the backend and allows for important time operations to happen if network connectivity is not immediately available. Multiple variants of the built CSPICE library are provided, including a limited, low-memory \"lite\" version with lesser functionality which is loaded by default. See [Constants](#Constants) section and [init](#init) function description for more information on the options.\n\nSome basic kernels are provided in this repo for performing time conversions. More kernels for other missions can be found [here](https://naif.jpl.nasa.gov/pub/naif/pds/data/).\n\n## Quick Start\n\n### Installation via NPM\n\n```shell\nnpm install timecraftjs\n```\n\n### Use with Webpack\n\nThe compiled emscripten blob includes `require( 'fs' )` which can cause Webpack to fail to compile for the web. In this case add the following options to the root of your Webpack config:\n\n```js\nnode: {\n    fs: \"empty\";\n}\n```\n\n### Time Conversion\n\n```js\nimport { Spice } from \"timecraftjs\";\n\nconst spiceInstance = await new Spice().init();\n\n// Load the kernels\nconst kernelBuffers = await Promise.all([\n    fetch(\"../kernels/lsk/naif0012.tls\").then((res) =\u003e res.buffer()),\n    fetch(\"../kernels/spk/de425s.bsp\").then((res) =\u003e res.buffer()),\n    fetch(\"../kernels/pck/pck00008.tpc\").then((res) =\u003e res.buffer()),\n]);\n\n// Load the kernels into Spice\nfor (let i = 0; i \u003c kernelBuffers.length; i++) {\n    spiceInstance.loadKernel(kernelBuffers[i]);\n}\n\n// Time conversion!\nconst utc = new Date().toISOString().slice(0, -1);\n\nconst et = spiceInstance.utc2et(utc);\n\nconst lst = spiceInstance.et2lst(et, 499, 0, \"planetocentric\");\n```\n\n### Loading a Metakernel\n\n```js\nimport { Spice, parseMetakernel } from \"timecraftjs\";\n\nconst spiceInstance = await new Spice().init();\n\n// load the kernel contents\nconst metaKernel = await fetch(\n    \"../kernels/extras/mk/msl_chronos_v07.tm\"\n).then((res) =\u003e res.text());\n\n// parse the kernel\nconst kernelPaths = parseMetakernel(metaKernel).paths;\n\n// load the kernels in the meta kernel\nconst kernelPromises = kernelPaths.map((p) =\u003e {\n    return fetch(p)\n        .then((res) =\u003e res.buffer())\n        .then((buffer) =\u003e spiceInstance.loadKernel(buffer));\n});\n\nawait Promise.all(kernelPromises);\n\n// ready for time conversion!\n```\n\n### Using the Chronos Function\n\n```js\nspiceInstance.chronos(\"617885388.6646054\", \"-from et -to utc -fromtype SECONDS\");\n```\n\n### Running the Example\n\n1.  Clone the Repository\n\n```sh\ngit clone https://github.com/NASA-AMMOS/timecraftjs.git\n```\n\n2.  Run the following on the base directory:\n\n```sh\nnpm install\nnpm start\n```\n\nThis will start a static server so you can visit the example page at `localhost:9080/example/`.\n\n### Table Of Contents\n\n#### [What Is TimeCraftJS?](#what-is-timecraftjs-1)\n\n#### [Included Files](#included-files-1)\n\n#### [API](#api-1)\n\n#### [Loading Kernels](#loading-kernels-1)\n\n#### [Recompiling cspice.js](#recompiling-cspicejs-1)\n\n### What Is TimeCraftJS?\n\nTimecraftJS is a time conversion library that uses [NAIF's CSPICE](https://naif.jpl.nasa.gov/naif/). In order to accomplish this, we automatically converted the C source code into Javascript via [Emscripten](http://kripken.github.io/emscripten-site/index.html). In order for them to work in a much more user friendly and Javascript-like way, we have created wrapper functions that interact with the resulting simulated C program, allocating and deallocating memory as necessary. This project only includes wrappers for the functions relevant to time conversion and some light time calculations. This project is an offshoot of spice.js.\n\nA great deal below deals with the loading and furnishing of kernels. If you do not wish to do any time conversions involving specific spacecraft or planets, the default included kernels are sufficient and you may ignore these sections. The default kernels are enough to refer to most NAIF ID's, a planetary constants kernel, and a leap seconds kernel.\nSee example-timecraftjs.html for a simple demo of TimeCraftJS working.\n\n### Included Files\n\nThis section lists the files included in this package and describes what each of them does. This section is mainly for people who wish to modify this package, if you simply wish to use it you can likely skip this section.\n\n#### src/cspice/*.js\n\nThese files contain the emscripten-converted CSPICE source code. It is extremely large and should not be modified. Both a \"full\" and \"lite\" version of converted CSPICE is provided. See the [Constants](#Constants) section for more information on the variants.\n\n#### src/spice.js\n\nThis file contains the wrapper class that allows access to the functionality in cspice.js. The version of spice.js here is focused on time conversions, but the rest of the CSPICE functionality could be exposed if needed.\n\n## API\n\n### Constants\n\nConstants for use in the [Spice.init](#init) function to intialize the library to use either a full or lite version of the SPICE library.\n\n#### ASM_SPICE_FULL\n\nUse this constant to load and use the full asm.js version of the SPICE library with full functionality. Run time memory requirement is around 100 MB.\n\n#### ASM_SPICE_LITE\n\nUse this constant to load and use an asm.js version of an unofficial \"lite\" version of the SPICE library with some missing functonality to improve memory requirements. Specifically all `ek*` functions have been removed and various internal constants have been lowered to reduce memory use. Not all NAIF kernels can be guaranteed to function when using this reduced memory of the package. If an error occurs due to overrunning memory use the \"full\" version, instead. Run time memory requirement is around 20 MB.\n\n### Spice\n\nClass used to instantiate an instance of Spice. Multiple instances can be created to load different kernels if desired. [init](#init) must be called before use.\n\n_Note that due to the memory requirements of CSpice each instance of this class will take around 100MB of memory._\n\n#### .ready\n\n```js\nready : Boolean\n```\n\nWhether the class has been fully initialized after [init](#init) has been called.\n\n#### .whenReady\n\n```js\nwhenReady : Promise\u003cthis\u003e\n```\n\nResolves when the class has been fully initialized after [init](#init) has been called.\n\n#### .onStdOut\n\n```js\nonStdOut : ( log : String ) =\u003e void\n```\n\nCallback that gets fired whenever CSpice logs to stdout. Defaults to log to console.\n\n#### .onStdErr\n\n```js\nonStdErr : ( log : String ) =\u003e void\n```\n\nCallback that gets fired whenever CSpice logs to stderr. Defaults to log error to console.\n\n#### .module\n\n```js\nmodule : Object = null\n```\n\nThis is the raw Emscripten compiled module that is used to call CSpice functions and interact with the virtual file system. There is typically no need to use this object but unexposed CSpice functions can be called here using `ccall`.\n\n`Module` and `FS` are created by Emscripten to interact directly with the ported C code and with the simulated C file system. Avoid using them unless you have read the [Interacting With Code](http://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html) and [preamble.js](http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html#ccall) sections of the Emscripten documentation.\n\n`module` is null until [init](#init) has fully resolved.\n\n#### .init\n\n```js\ninit( type : ( ASM_SPICE_LITE | ASM_SPICE_FULL ) = ASM_SPICE_LITE ) : Promise\u003cthis\u003e\n```\n\nLoads and initializes the CSpice module. The class is ready to use once the promise has resolved.\n\nThe \"type\" parameter can be used to dictate which version of the compiled CSPICE module to use. See the [Constants](#Constants) section for available options and more information. Defaults to using the \"lite\" version of the module.\n\n#### .loadKernel\n\n```js\nloadKernel( buffer : ArrayBuffer | Uint8Array, key : String = null ) : void\n```\n\nLoad the provided buffer into Spice as a kernel. The provided key can be used to unload the kernel using [unloadKernel](#unloadKernel). Throws an error if the key has already been used. Details of kernel management can be found in the [Kernel Management](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/req/kernel.html#Section%205%20--%20Kernel%20Management) section of the SPICE docs.\n\n#### .unloadKernel\n\n```js\nunloadKernel( key : String ) : void\n```\n\nUnload the kernel that was loaded with the given key. Throws an error if a kernel has not been loaded with the given key.\n\n#### .chronos\n\n```js\nchronos( inptim : String, cmdlin : String ) : String\n```\n\nWrapper for the CSpice command line utility that calls the `cronos_` function internally. `inptim` is the input time to convert while `cmdlin` is the list of command line arguments as a string. See the [chronos](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/ug/chronos.html) docs for more information.\n\n#### Spice Functions\n\nMost of the functions made available in this library are functions from CSPICE called in a more Javascript-like way. Please see [differences between cspice and spice.js](https://github.com/NASA-AMMOS/timecraftjs.js#differences-between-cspice-and-spicejs) for specifics.\n\nWhile the ported C code technically contains all CSPICE functionality, the following functions have been exposed in this class. The [CSPICE documentation](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/index.html) for each of these functions is correct, but below you can see their more Javascript-like call format supported here. All documented CSpice function inputs are passed into the Javascript equivelants below while all outputs are returned as a dictionary indexed by parameter name or as a single value if there is only a single output.\n\n```\nb1900()\nb1950()\nbodc2n( code )\nbodc2s( code )\nboddef( name, code )\nbodfnd( body, item )\nbodn2c( name )\nbods2c( name )\nbodvcd( bodyid, item, maxn )\nbodvrd( body, item, maxn )\nconvrt( x, in_var, out )\ndeltet( epoch, eptype )\nerract( op, action )\nerrprt( op, list )\net2lst( et, body, lon, type )\net2utc( et, format, prec )\netcal( et )\nfailed()\nfurnsh( kernelPaths )\ngetmsg( options )\nj1900()\nj1950()\nj2000()\nj2100()\njyear()\nltime( etobs, obs, dir, targ )\nreset()\nscdecd( sc, sclkdp )\nsce2c( sc, et )\nsce2s( sc, et )\nsce2t( sc, et )\nscencd( sc, sclkch )\nscfmt( sc, ticks )\nscpart( sc )\nscs2e( sc, sclkch )\nsct2e( sc, sclkdp )\nsctiks( sc, clkstr )\nspd()\nspkpos( targ, et, ref, abcorr, obs )\nstr2et( str )\ntimdef( action, item, value )\ntimout( et, pictur )\ntparse( string )\ntpictr( sample )\ntsetyr( year )\ntyear()\nunitim( epoch, insys, outsys )\nunload( file )\nutc2et( utcstr )\n```\n\n### Functions\n\n#### isMetakernel\n\n```js\nisMetakernel( contents : String | ArrayBuffer | Uint8Array ) : Boolean\n```\n\nTakes the contents of a kernel file and returns `true` if it is a metakernal and `false` otherwise. This function looks for the `KERNELS_TO_LOAD` token in the file.\n\n#### parseMetakernel\n\n```js\nparseMetakernel( contents : String | ArrayBuffer | Uint8Array ) : { fields: Object, paths: Array\u003cString\u003e }\n```\n\nParses the contents of a metakernel `.tm` file and returns all the key value pairs in the file as `fields` and all preprocessed referenced metakernal paths as `paths`.\n\n## Loading Kernels\n\nIn order to load an read kernels the data must be loaded into the virtual Emscripten file system as a binary buffer.\n\n### In the Browser\n\nFiles must be downloaded asynchronously as array buffers before being loaded into the app.\n\n```js\nimport { Spice } from \"timecraftjs\";\n\nconst spiceInstance = await new Spice().init();\nconst kernelBuffer = await fetch(\"../path/to/kernel\").then((res) =\u003e res.buffer);\nspiceInstance.loadKernel(buffer);\n```\n\n### In Node\n\nIn node files can be loaded from the filesystem directly.\n\n```js\nimport fs from \"fs\";\nimport { Spice } from \"timecraftjs\";\n\nconst spiceInstance = await new Spice().init();\nconst kernelBuffer = fs.readFileSync(\"../path/to/kernel\");\nspiceInstance.loadKernel(buffer);\n```\n\n## Recompiling cspice.js\n\nThe files in `src/cspice/` are the massive Javascript files resulting from the automatic porting via Emscripten. As such, if CSPICE updates, these files will need to be recompiled. In order to recompile any of the JS CSPICE files, follow these steps:\n\n### Setting Up Emscripten\n\n1. Download relevant toolkit from [the NAIF website](https://naif.jpl.nasa.gov/naif/toolkit_C.html).\n1. Download [emsdk](https://github.com/emscripten-core/emsdk) to download and manage \"emscripten\" versions.\n1. Install the latest version of emscripten and source the emsdk environment variables from `emsdk_env.sh`.\n\n### CSPICE Full (asm_full.js)\n\nThe current version was created from the [Mac/OSX 64 Bit Toolkit](https://naif.jpl.nasa.gov/naif/toolkit_C_MacIntel_OSX_AppleC_64bit.html) on April 12, 2021 with emscripten version 2.0.17.\n\n1. Unzip the CSPICE source folder and put the contents into the `generation/cspice-full` folder.\n1. Ensure the `LITE_BUILD` variable is set to `False` in `generation/generate-cspice.sh`.\n1. Run `generation/generate-cspice.sh` to generate the js library file in the folder.\n1. Move the newly generated `asm_full.js` file into the `src/cspice` folder.\n\n### CSPICE Lite (asm_lite.js)\n\n_INTERNAL ONLY_\n\nThe modified lite version of the CSPICE used was dervied from the latest version of CSPICE on April 27, 2021 with emscripten version 2.0.17. The CSPICE lite code only provides modified `src/cspice` functions so necessary chronos functionality is copied from the latest public version.\n\n1. Unzip the latest CSPICE source folder (see above) and put the contents into the `generation/cspice-full` folder.\n1. Unzip the CSPICE lite source folder and put the contents into the `generation/cspice-lite` folder. Modified CSPICE lite source available [here](https://github.jpl.nasa.gov/gkjohnso/cspice-lite) (internal only).\n1. Ensure the `LITE_BUILD` variable is set to `True` in `generation/generate-cspice.sh`.\n1. Run `generation/generate-cspice.sh` to generate the js library file in the folder.\n1. Move the newly generated `asm_lite.js` file into the `src/cspice` folder.\n\n## License\n\nCopyright 2020, by the California Institute of Technology.\nALL RIGHTS RESERVED.\nUnited States Government Sponsorship acknowledged. Any commercial use must be negotiated with the Office of Technology Transfer at the California Institute of Technology.\nThis software may be subject to U.S. export control laws. By accepting this software, the user agrees to comply with all applicable U.S. export laws and regulations. User has the responsibility to obtain export licenses, or other export authority as may be required before exporting such information to foreign countries or providing access to foreign persons.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnasa-ammos%2Ftimecraftjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnasa-ammos%2Ftimecraftjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnasa-ammos%2Ftimecraftjs/lists"}