New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

6px

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

6px - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

6

examples/crop.js

@@ -1,5 +0,3 @@

var px = require('../.');
px.init({
userId: '***USER_ID***',
var px = require('../.')({
userId: '***API_KEY***',
apiKey: '***API_KEY***',

@@ -6,0 +4,0 @@ apiSecret: '***API_SECRET***'

@@ -1,5 +0,3 @@

var px = require('../.');
px.init({
userId: '***USER_ID***',
var px = require('../.')({
userId: '***API_KEY***',
apiKey: '***API_KEY***',

@@ -6,0 +4,0 @@ apiSecret: '***API_SECRET***'

@@ -1,5 +0,3 @@

var px = require('../.');
px.init({
userId: '***USER_ID***',
var px = require('../.')({
userId: '***API_KEY***',
apiKey: '***API_KEY***',

@@ -6,0 +4,0 @@ apiSecret: '***API_SECRET***'

@@ -1,5 +0,3 @@

var px = require('../.');
px.init({
userId: '***USER_ID***',
var px = require('../.')({
userId: '***API_KEY***',
apiKey: '***API_KEY***',

@@ -6,0 +4,0 @@ apiSecret: '***API_SECRET***'

@@ -1,5 +0,3 @@

var px = require('../.');
px.init({
userId: '***USER_ID***',
var px = require('../.')({
userId: '***API_KEY***',
apiKey: '***API_KEY***',

@@ -6,0 +4,0 @@ apiSecret: '***API_SECRET***'

@@ -154,24 +154,3 @@ var version = require('../package.json').version;

*/
px.init = function(data) {
if (px.userData) {
throw '6px: Init must only be called once!';
}
if (!data.apiKey) {
throw '6px: apiKey is required!';
}
if (!data.userId) {
throw '6px: userId is required!';
}
if (!data.apiSecret) {
throw '6px: apiSecret is required!';
}
px.userData = data;
};
px.openSocket = function() {

@@ -275,2 +254,23 @@

module.exports = px;
module.exports = function(data) {
if (px.userData) {
throw '6px: Init must only be called once!';
}
if (!data.apiKey) {
throw '6px: apiKey is required!';
}
if (!data.userId) {
throw '6px: userId is required!';
}
if (!data.apiSecret) {
throw '6px: apiSecret is required!';
}
px.userData = data;
return px;
};
{
"name": "6px",
"version": "0.0.8",
"version": "0.0.9",
"description": "NodeJS SDK for 6px.io",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,4 +0,79 @@

6px-node-sdk
NodeJS 6px SDK
============
Node.js 6px SDK
Wrapper to the 6px image processing API. Includes methods to make the process of sending over jobs easier.
More examples can be found in the examples directory, but here's a sample of adding a watermark to an image.
```javascript
var px = require('6px')({
userId: '***USER_ID***',
apiKey: '***API_KEY***',
apiSecret: '***API_SECRET***'
});
/**
* Load our images
*
* It can be a path to a file on your machine.
* It can be a buffer.
* It can be a location on the internet.
*/
var image = px({
taxi: './images/unsplash_city_taxi.jpg',
logo: 'http://6px.io/img/px-logo-md@2x.png'
});
/**
* Create a new output object.
*
* We need to tell that output which input we are working with.
* In this case we will use the taxi as the main image. We use an object, that way we can specify the filename that we want to use. You do have the option of just putting `false` in there, and 6px will generate a name for you.
*/
var output = image.output({ taxi: 'unsplashed_6px_watermark' });
/**
* We are now adding a layer action. We are referring to the other input we defined earlier.
*
* Some options are opacity, x, y, width, height.
*/
output.layer('logo', {
opacity: 0.6
});
// Where does the image end up? Passing `6px` will send it to 6px's CDN.
output.url('6px');
/**
* Send to 6px! The result will be a response from the API with the ID.
*
* This doesn't mean the job is done. This means the API has received the request.
*/
image.save(function(err, res) {
console.log(res);
});
```
All of those methods are chainable, by the way:
```javascript
var px = require('6px')({
userId: '***USER_ID***',
apiKey: '***API_KEY***',
apiSecret: '***API_SECRET***'
});
var image = px({
taxi: './images/unsplash_city_taxi.jpg',
logo: 'http://6px.io/img/px-logo-md@2x.png'
});
image.output({ taxi: 'unsplashed_6px_watermark' })
.layer('logo', {
opacity: 0.6
})
.url('6px');
image.save(function(err, res) {
console.log(res);
});
```
Granted, we lost the comments, but you can see most of the methods are set up to be chainable.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc