Node interface to OSX Pasteboard


Improved pbcopy/pbpaste for OSX

npm install pb

$ pb [type]
$ get_data | pb -s [type]

For example, to grab the contents of the html pasteboard and put it on the plaintext pasteboard:

$ pb html | pb -s

From node, pb exposes:

  • get(type): get pasteboard data from specified pasteboard
  • set(type, data): set pasteboard data (overwrites other pasteboards)
var pb = require('pb');
var HTMLOutput = pb.get('html');
var textOutput = pb.get();
  • NSStringPboardType (plaintext)
  • NSHTMLPboardType (HTML)