Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: ae42736ff6
Fetching contributors…

Cannot retrieve contributors at this time

51 lines (33 sloc) 1.04 kb

node-clipboard

Easy to use utility for reading and writing to the system clipboard.

usage

npm install clipboard
var clipboard = require('clipboard');

// _Read_
var fromClipboard = clipboard.read();     // defaults to ascii
fromClipboard = clipboard.read('bitmap'); // buffer
fromClipboard = clipboard.readAll();      // all formats

// _Write_
clipboard.write('some text');
clipboard.write([
    { format: 'ascii', value: 'some text' },
    { format: 'unicode', value: '\u1059\u0000etc' },
    { format: 'bitmap', value: someBuffer }
]);

// _Clear_
clipboard.clear();

// _Iterate_

// clipboard.formats() is a shortcut for:

var formats = clipboard.iterate(function(format, formatName, isCustom){
    return formatName;
});



// _JavaScript Objects_

// copies a v8 handle to the clipboard, not serialized
// also copies in the util.inspect text into 'ascii'
clipboard.write({ realJSObject: true });

// this will CRASH node if you try to paste it into another node process
var obj = clipboard.read('jsobject');
Jump to Line
Something went wrong with that request. Please try again.