https://github.com/magicdawn/simple-mac-clipboard
simple mac clipboard for node & electron
https://github.com/magicdawn/simple-mac-clipboard
clip clipboard mac-clipboard
Last synced: about 1 year ago
JSON representation
simple mac clipboard for node & electron
- Host: GitHub
- URL: https://github.com/magicdawn/simple-mac-clipboard
- Owner: magicdawn
- License: mit
- Created: 2020-02-29T06:39:11.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-01-13T11:07:04.000Z (over 1 year ago)
- Last Synced: 2025-03-22T09:34:52.138Z (over 1 year ago)
- Topics: clip, clipboard, mac-clipboard
- Language: Objective-C++
- Size: 494 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# simple-mac-clipboard
> simple mac clipboard for node & electron
[](https://www.npmjs.com/package/simple-mac-clipboard)
[](https://www.npmjs.com/package/simple-mac-clipboard)
[](http://magicdawn.mit-license.org)
## Install
```sh
$ npm i -S simple-mac-clipboard
```
## Related
https://github.com/electron/electron/issues/9035
## API
> based on https://developer.apple.com/documentation/appkit/nspasteboard
```js
const clip = require('simple-mac-clipboard')
```
### Note
- for read & write, format is required, and format is always the **first** argument
- for write, the boolean return value is for success or not, map from objc `YES` or `NO`
### `clear`
```ts
export function clear(): void
```
clear the clipboard
### readBuffer & writeBuffer
```ts
export function readBuffer(format: string): Buffer
export function writeBuffer(format: string, data: Buffer): boolean
```
read or write `Buffer` from/to the clipboard
### readText & writeText
```ts
export function readText(format: string): string
export function writeText(format: string, text: string): boolean
```
read or write text from/to the clipboard
## Changelog
[CHANGELOG.md](CHANGELOG.md)
## License
the MIT License http://magicdawn.mit-license.org