npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@aics/aicsfiles

v3.0.6

Published

Client library for the AICS File Storage Service

Downloads

94

Readme

aicsfiles-js

This is a JavaScript client to the AICS File Storage Service. It provides the API to initiate, process and complete an upload of files. The client requires access to the computer's filesystem in order to copy files to the destination directory. Thus the process using it must have access to NodeJS libraries such as fs, os, path, etc. If included inside of an electron application, this should be used in the "main" process.

Eventually it will also provide API to query for and access previously uploaded files.

Level of Support

We are not currently supporting this code for external use, but simply releasing it to the community AS IS. It is used for within our organization. We are not able to provide any guarantees of support. The community is welcome to submit issues, but you should not expect an active response.

Getting started

Install the library:

yarn add @aics/aicsfiles

Create FMS instance:

const uploadClient = new FileManagementSystem(LIMS_HOST, LIMS_PORT, "debug");

Example Usage

const startUpload = async (uploads, jobName) => {
    try {
        const startUploadResponse = await uploadClient.validateMetadataAndGetUploadDirectory(uploads);
        /* result will look something like this:
        {
            jobId: "2f55ea322a654e35b98d003a74f9170e",
            uploadDirectory: "/tmp/lk/fss/incoming/asdf
        }
        **/

        const result = await uploadClient.uploadFiles(startUploadResponse, uploads, jobName);
        /*  result will look something like:
        * {
        *   a-filename.txt: {
        *       fileId: "65ebf71c8f1046dcb52931e4aa9db0f4", 
        *       fileName: "Nunito-Regular.ttf",
        *       readPath: "/allen/aics/apps/stage/file-storage-service/data/f4/65ebf71c8f1046dcb52931e4aa9db0f4"
        *   }
        *   ...
        * } 
        * */
       console.log("Upload complete", result);
    } catch (e) {
        console.log("Upload failed", e)
    }
};

const retryUpload = async (uploadJob) => {
    Logger.debug("received start upload request from renderer");
    const uploadClient = new FileManagementSystem(LIMS_HOST, LIMS_PORT, "debug");
    try {
        const result = await uploadClient.retryUpload(uploadJob);
        /*  result will look something like:
        * {
        *   a-filename.txt: {
        *       fileId: "65ebf71c8f1046dcb52931e4aa9db0f4", 
        *       fileName: "Nunito-Regular.ttf",
        *       readPath: "/allen/aics/apps/stage/file-storage-service/data/f4/65ebf71c8f1046dcb52931e4aa9db0f4"
        *   }
        *   ...
        * } 
        * */
        console.log("Upload complete", result);
    } catch (e) {
        console.log("Upload failed", e)
    }
};

startUpload({
    "/home/foo/kitties.txt": {
        file: {
            originalPath: "/home/foo/kitties.txt", // required
            fileType: "other", // required
            numberCats: 3, // arbitrary fields are allowed
        },
        anotherProperty: "foo", // arbitrary fields here are also allowed
    }
});

retryUpload(uploadJobFromJSS);

Library development

NOTE: We're using yarn for dependency management. If you don't have yarn already, set it up by following these instructions:

https://yarnpkg.com/en/docs/install#debian-stable

Gradle Tasks

Description of Gradle tasks:

| script | comments | | ------ | -------- | | build | create CommonJS and ES module builds | | bundle | run Webpack to create a UMD bundle | | clean | remove generated artifacts | | format | run prettier on src directory | | generateTypes | generate type declarations | | lint | run eslint on src directory | | transpileCommonJs | run babel on src directory; transpile import/export statements for a CommonJS compatible build | | transpileES | run babel on src directory; do not transpile import/export statements for an ES module compatible build (used by bundlers for tree-shaking) | | test | run mocha; searches for any files matching the pattern "src/**/*.test.js" | | typeCheck | run tsc in type-check only mode |

Simultaneously working on application and library

You can test a development copy of the library in another application using yarn-link:

yarn link creates a symlink for the library that points to your development copy.

  1. Run yarn link in the root of this repository
  2. Run yarn link @aics/aicsfiles in the root of your application

Publishing

After merging to master, create a release build specifying the type of release ('patch', 'minor', 'major') and checking PUBLISH. https://jenkins.corp.alleninstitute.org/job/node-packages/job/aicsfiles/job/master/build?delay=0sec