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

appcenter-file-upload-client

v0.1.0

Published

Upload client for App Center services

Downloads

802,330

Readme

FileUploadClient - client to simplify upload process for AppCenter needs using Microsoft file upload service

Build

  1. npm install
  2. npm run build

Scripts

There are a bunch of scripts in package.json file. Here's what they are and what they do:

| Script command | What it does | |----------------|------------- | | npm run build | Compiles the typescript into javascript, creates dist directory. | | npm run clean | Cleans up any compilation output. | | npm run prepublish | Clean dist folder, compiles ts and moves js to dist folder. |

There will be more over time.

Publish package updates to npm

If you don't already have a user account in npm, go to your terminal and type in npm adduser and follow the instructions to create an account.

Go to npmjs.com/package/appcenter-file-upload-client to view the list of admins.

Ask one of the current admins to add you to the package as an admin in npm.

Wait 30 minutes after getting added to the package and then go to your terminal and type.

npm run prepublish

npm publish

If you have auth issues when running these commands type npm login in your terminal and follow the instructions to log in.

JavaScript API Reference

After importing, file-upload-client module could be used by calling upload method, accepting the following object:

interface IFileUploadClientSettings {
  assetId: string;
  assetDomain: string;
  assetToken: string;
  filePath: string;
  useLogging?: boolean;

  onProgressChanged?(progress: IProgress): void;
  onMessage?(errorMessage: string, MessageLevel: MessageLevel): void;
  onStateChanged?(status: FileUploadServiceState): void;
}

NOTE: assetId/assetDomain/assetToken should be provided by File Upload Service.

The upload events adds useful hooks to track upload process.

File Upload client public methods avaliable:

  • [upload]: Uploads file by providing relevant information fetched from Upload Service:
const fileUploadData = {
  assetId: "",
  assetToken: "",
  assetUploadDomian: ""
};

Example Usage:

new FileUploadClient().upload(<IFileUploadClientSettings>{
  onMessage: (uploadMessage: string, messageLevel: MessageLevel) => {
    console.log(`Upload message:  ${uploadMessage}`);
  },
  onProgressChanged: (progressData: IProgress) => {
    console.log(`Upload progress: ${progressData.percentCompleted}`);
  },
  assetId: fileUploadData.assetId,
  assetDomain: fileUploadData.assetUploadDomian,
  assetToken: fileUploadData.assetToken,
  filePath: FILE_PATH
}).then((uploadResult: IUploadResults) => {
  console.log("Wow, upload completed, use this URL to download file: ", uploadResult.downloadUrl);
}).catch((error: FileUploadError) => {
  console.log('An error occured: ', error.message);
});
  • [cancel]: Cancel current upload:

Example Usage:

const uploadClient = new FileUploadClient({ ... });
uploadClient.upload( { ... });
uploadClient.cancel();
  • [isUploadInProgress]: Check if upload is already in progress:

Example Usage:

const uploadClient = new FileUploadClient({ ... });
const isInProgress = uploadClient.isUploadInProgress();