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

ass-client

v2.2.0

Published

Aptoma Smooth Storage client

Downloads

158

Readme

Build Status

ass-client-js

JavaScript client for Aptoma Smooth Storage.

Installation

This module is installed via NPM:

$ npm install ass-client

Examples

Upload and resize image (in Node.js)

var assClient = require('ass-client')({
	httpUrl: 'http://ass.com',
	httpsUrl: 'https://ass.com',
	accessToken: 'secret',
	username: 'foobar'
});

assClient.uploadImage('my.jpg').then(function (res) {
	var signedUrl = assClient.createImageUrl(res.id, {
		resize: {
			width: 100,
			height: 100
		}
	});
	// Create a signed URL for the uploaded image in a different size
	console.log('Smaller image', signedUrl);
});

Upload and resize image (in browser)

<script src="ass-client-js/dist/ass-client.js"></script>
<script>
	var assClient = AssClient({
		httpUrl: 'http://ass.com',
		httpsUrl: 'https://ass.com',
		accessToken: 'secret',
		username: 'foobar'
	});

	assClient.uploadImage(file).then(function (res) {
		var signedUrl = assClient.createImageUrl(res.id, {
			resize: {
				width: 100,
				height: 100
			}
		});
		// Create a signed URL for the uploaded image in a different size
		console.log('Smaller image', signedUrl);
	});
</script>

Documentation

ASS(opts)

Create ASS API instance.

Parameters

opts: Object, Create ASS API instance

opts.httpUrl: String, URL to use for HTTP requests.

opts.httpsUrl: String, URL to use for HTTPS requests.

opts.accessToken: String, Token used for accessing the API and signing URLs.

opts.username: String, Username used in paths.

getDefaultHeaders(add)

Get default headers.

Parameters

add: Object, Add headers

Returns: Object

upload(endpoint, file, [headers])

Upload file to endpoint.

Parameters

endpoint: String, Upload file to endpoint

file: File | String | stream.Readable, File object, full path to the file or stream.Readable

headers: Object, Add additional headers

Returns: Promise, Resolves with response object

uploadFile(file, [path], [headers]).

Upload a file to /files endpoint.

Parameters

file: File | String | stream.Readable, File object, full path to the file or stream.Readable

path: String, Additional path to append to /files

headers: Object, Add additional headers

Returns: Promise, Resolves with response object

uploadImage(file, [headers])

Upload a image to /images endpoint.

Parameters

file: File | String | stream.Readable, File object, full path to the file or stream.Readable

headers: Object, Add additional headers

Returns: Promise, Resolves with response object

request(endpoint, [data], [opts])

Make a request to an endpoint.

Parameters

endpoint: String, Make a request to an endpoint

opts: Object, Options to the request

opts.http: Boolean, Set to true if request should use HTTP instead of HTTPS URL

opts.method: String, Request method (GET/HEAD/POST/PUT/PATCH/DELETE)

opts.headers: Object, Add additional headers

opts.timeout: Number, Number of ms to wait before timing out

opts.body: String | Object, Data to send

Returns: Promise, Resolves with response object

get(endpoint, [opts])

Make a GET request to an endpoint.

Parameters

endpoint: String, Make a request to an endpoint

opts: Object, Options to request

Returns: Promise, Resolves with response object

head(endpoint, [opts])

Make a HEAD request to an endpoint.

Parameters

endpoint: String, Make a request to an endpoint

opts: Object, Options to request

Returns: Promise, Resolves with response object

post(endpoint, [data], [opts])

Make a POST request to an endpoint.

Parameters

endpoint: String, Make a request to an endpoint

data: String | Object, Data to send as body

opts: Object, Options to request

Returns: Promise, Resolves with response object

patch(endpoint, [data], [opts])

Make a PATCH request to an endpoint.

Parameters

endpoint: String, Make a request to an endpoint

data: String | Object, Data to send as body

opts: Object, Options to request

Returns: Promise, Resolves with response object

put(endpoint, [data], [opts])

Make a PUT request to an endpoint.

Parameters

endpoint: String, Make a request to an endpoint

data: String | Object, Data to send as body

opts: Object, Options to request

Returns: Promise, Resolves with response object

delete(endpoint, [opts])

Make a DELETE request to an endpoint.

Parameters

endpoint: String, Make a request to an endpoint

opts: Object, Options to request

Returns: Promise, Resolves with response object

getUrl(endpoint, http)

Get full URL to ASS endpoint, defaults to https URL.

Parameters

endpoint: String, Get full url to ASS endpoint, defaults to https url

http: Boolean, if we should return http url

Returns: String

createImageUrl(id, actions)

Create a signed URL from image id and actions.

Parameters

id: Integer, image id

actions: Object, Create a signed url from image id and actions

Returns: String

createSignature(url)

Create signature for a image or file URL.

Parameters

url: String, Create transformation signature

Returns: String