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.3.0 to 0.3.1

2

package.json
{
"name": "pb",
"version": "0.3.0",
"version": "0.3.1",
"author": "SheetJS",

@@ -5,0 +5,0 @@ "description": "Interface to OSX Pasteboard",

@@ -1,9 +0,11 @@

/* pb.js -- (C) 2013-2015 SheetJS -- http://sheetjs.com */
/* pb.js -- (C) 2013-present SheetJS -- http://sheetjs.com */
/* vim: set ts=2: */
/*jshint node:true */
var $ = require('nodobj'+'c');
var $ = require('nodobjc');
$.framework('AppKit');
$.NSAutoreleasePool('alloc')('init');
var basetypes = [ 'HTML', 'PNG', 'TEXT' ];
exports.version = '0.3.1';
var basetypes = [ 'HTML', 'PNG', 'TEXT', 'RTF' ];
var alltypes;

@@ -14,5 +16,6 @@

switch(type.toUpperCase()) {
case 'HTML': return [$.NSHTMLPboardType, 's'];
case 'PNG': return [$.NSHTMLPboardType, 'i'];
case 'TEXT': return [$.NSStringPboardType, 's'];
case 'HTML': return [$.NSHTMLPboardType, 's'];
case 'PNG': return [$.NSHTMLPboardType, 'i'];
case 'TEXT': return [$.NSStringPboardType, 's'];
case 'RTF': return [$.NSRTFPboardType, 's'];
}

@@ -22,5 +25,5 @@ return [$[type], 's'];

var filterfunc = function(x/*:string*/)/*:boolean*/ { return !!(x.match(/^NS.*PboardType$/)); };
exports.gettypes = function gettypes()/*:Array<any>*/ {
if(!alltypes) {
var filterfunc = function(x) { return x.match(/^NS.*PboardType$/); };
var nstypes = Object.keys($).filter(filterfunc);

@@ -32,4 +35,2 @@ alltypes = basetypes.concat(nstypes);

exports.version = '0.3.0';
exports.get = function get(type/*:string*/)/*:any*/ {

@@ -60,1 +61,13 @@ var x = $.NSPasteboard('generalPasteboard');

};
function NSArray2ArrayStr(arr)/*:Array<string>*/ {
var out/*:Array<string>*/ = [];
var len = arr('count');
for(var i = 0; i < len; ++i) out[i] = arr('objectAtIndex', i).toString();
return out;
}
exports.available = function avail()/*:Array<string>*/ {
var x = $.NSPasteboard('generalPasteboard');
return NSArray2ArrayStr(x('types'));
};

@@ -13,7 +13,11 @@ # pb

$ npm install -g pb
```bash
$ npm install -g pb
```
Depending on your system configuration, you may need to run as root:
$ sudo npm install -g pb
```bash
$ sudo npm install -g pb
```

@@ -24,12 +28,18 @@ ## Command-Line Tool Usage

$ pb [type]
$ pb -m <type>
```bash
$ pb [type]
$ pb -m <type>
```
To set a specific pasteboard, be sure to pipe data into pb:
$ get_data | pb -s [type]
```bash
$ get_data | pb -s [type]
```
To list available pasteboards:
$ pb -l
```bash
$ pb -l
```

@@ -39,3 +49,5 @@ For example, to grab the contents of the HTML pasteboard and put it on the

$ pb -m html | pb -s
```bash
$ pb -m html | pb -s
```

@@ -48,2 +60,3 @@ ## Library Usage

- `set(type, data)`: set pasteboard data (overwrites other pasteboards)
- `available()`: enumerate populated pasteboards
- `gettypes()`: enumerate available pasteboards

@@ -54,3 +67,3 @@

```
```js
var pb = require('pb');

@@ -57,0 +70,0 @@ var HTMLOutput = pb.get('html');

Sorry, the diff of this file is not supported yet

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