Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pb

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pb - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

.flowconfig

31

package.json
{
"name": "pb",
"version": "0.2.1",
"version": "0.3.0",
"author": "SheetJS",
"description": "Node interface to OSX Pasteboard",
"keywords": [
"osx",
"mac",
"clipboard"
],
"description": "Interface to OSX Pasteboard",
"keywords": [ "osx", "mac", "pasteboard", "clipboard" ],
"bin": {
"pb": "./pboard.njs"
"pb": "./bin/pboard.njs"
},
"main": "./pb",
"main": "pb.js",
"dependencies": {
"NodObjC": "0.0.15"
"nodobjc": "",
"commander": ""
},
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/SheetJS/pb.git"
},
"bugs": {
"url": "https://github.com/SheetJS/pb/issues"
},
"preferGlobal": "true"
"repository": { "type": "git", "url": "git://github.com/SheetJS/pb.git" },
"preferGlobal": "true",
"bugs": { "url": "https://github.com/SheetJS/pb/issues" },
"license": "Apache-2.0",
"engines": { "node": ">=0.8" }
}

@@ -1,16 +0,33 @@

var $ = require('nodobjc');
/* pb.js -- (C) 2013-2015 SheetJS -- http://sheetjs.com */
/* vim: set ts=2: */
/*jshint node:true */
var $ = require('nodobj'+'c');
$.framework('AppKit');
var pool = $.NSAutoreleasePool('alloc')('init');
$.NSAutoreleasePool('alloc')('init');
var mytype = exports.mytype = function(type) {
if(!type) return [$.NSStringPboardType, 's'];
switch(type) {
case 'HTML': case 'html': return [$.NSHTMLPboardType, 's'];
case 'PNG': case 'png': return [$.NSHTMLPboardType, 'i'];
case 'TEXT': case 'text': return [$.NSStringPboardType, 's'];
var basetypes = [ 'HTML', 'PNG', 'TEXT' ];
var alltypes;
var mytype = exports.mytype = function mytype(type/*:string*/)/*:Array<any>*/ {
if(!type) return [$.NSStringPboardType, 's'];
switch(type.toUpperCase()) {
case 'HTML': return [$.NSHTMLPboardType, 's'];
case 'PNG': return [$.NSHTMLPboardType, 'i'];
case 'TEXT': return [$.NSStringPboardType, 's'];
}
return [$[type], 's'];
}
};
exports.get = function(type) {
exports.gettypes = function gettypes()/*:Array<any>*/ {
if(!alltypes) {
var filterfunc = function(x) { return x.match(/^NS.*PboardType$/); };
var nstypes = Object.keys($).filter(filterfunc);
alltypes = basetypes.concat(nstypes);
}
return alltypes;
};
exports.version = '0.3.0';
exports.get = function get(type/*:string*/)/*:any*/ {
var x = $.NSPasteboard('generalPasteboard');

@@ -23,8 +40,9 @@ var tt = mytype(type);

case 'i': {
var y = $.NSImage('alloc')('initWithPasteboard', x)
var y = $.NSImage('alloc')('initWithPasteboard', x);
return y;
}
}
}
};
exports.set = function(type, str) {
exports.set = function set(type/*:string*/, str/*:string*/)/*:void*/ {
var x = $.NSPasteboard('generalPasteboard');

@@ -39,2 +57,2 @@ var tt = mytype(type);

}
}
};

@@ -5,20 +5,37 @@ # pb

The standard pbcopy and pbpaste utilities can manipulate the plaintext clipboard
but have no easy way of accessing the HTML pasteboard. This module and CLI tool
provide a more convenient way to access the pasteboard from node.
## Installation
`npm install pb`
With [npm](https://www.npmjs.org/package/pb), global installation is easiest:
## Usage
$ npm install -g pb
```
$ pb [type]
$ get_data | pb -s [type]
```
Depending on your system configuration, you may need to run as root:
For example, to grab the contents of the html pasteboard and put it on the
$ sudo npm install -g pb
## Command-Line Tool Usage
To get data from a specific pasteboard:
$ pb [type]
$ pb -m <type>
To set a specific pasteboard, be sure to pipe data into pb:
$ get_data | pb -s [type]
To list available pasteboards:
$ pb -l
For example, to grab the contents of the HTML pasteboard and put it on the
plaintext pasteboard:
$ pb -m html | pb -s
```bash
$ pb html | pb -s
```
## Library Usage

@@ -29,3 +46,7 @@ From node, `pb` exposes:

- `set(type, data)`: set pasteboard data (overwrites other pasteboards)
- `gettypes()`: enumerate available pasteboards
For example, to grab the contents of the HTML pasteboard and put it on the
plaintext pasteboard:
```

@@ -39,3 +60,10 @@ var pb = require('pb');

- `NSStringPboardType` (plaintext)
- `NSHTMLPboardType` (HTML)
- `NSStringPboardType` (plaintext)
- `NSHTMLPboardType` (HTML)
## License
Please consult the attached LICENSE file for details. All rights not explicitly
granted by the Apache 2.0 license are reserved by the Original Author.
[![Analytics](https://ga-beacon.appspot.com/UA-36810333-1/SheetJS/pb?pixel)](https://github.com/SheetJS/pb)

Sorry, the diff of this file is not supported yet

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