diff --git a/README.md b/README.md index beb73e0..7b0b638 100644 --- a/README.md +++ b/README.md @@ -316,7 +316,7 @@ Sets Windows clipboard content to the given text or a PNG image. Name | Type | Required | Description | Example --- | --- | --- | --- | --- b64Content | string | yes | Base64-encoded content of the clipboard to be set | `QXBwaXVt` -contentType | 'text' or 'image' | no | Set to 'text' in order to set the given text to the clipboard (the default value). Set to 'image' if `b64Content` contains a base64-encoded payload of a PNG image. | image +contentType | 'plaintext' or 'image' | no | Set to 'plaintext' in order to set the given text to the clipboard (the default value). Set to 'image' if `b64Content` contains a base64-encoded payload of a PNG image. | image ### windows: getClipboard @@ -326,7 +326,7 @@ Retrieves Windows clipboard content. Name | Type | Required | Description | Example --- | --- | --- | --- | --- -contentType | 'text' or 'image' | no | Set to 'text' in order to set the given text to the clipboard (the default value). Set to 'image' to retrieve a base64-encoded payload of a PNG image. | image +contentType | 'plaintext' or 'image' | no | Set to 'plaintext' in order to set the given text to the clipboard (the default value). Set to 'image' to retrieve a base64-encoded payload of a PNG image. | image #### Returns diff --git a/lib/commands/clipboard.js b/lib/commands/clipboard.js index 82913d2..34e28fa 100644 --- a/lib/commands/clipboard.js +++ b/lib/commands/clipboard.js @@ -10,7 +10,7 @@ const commands = {}; */ /** - * @type {Record} + * @type { Record} */ const CONTENT_TYPE = Object.freeze({ plaintext: 'plaintext', @@ -35,10 +35,8 @@ commands.windowsSetClipboard = async function windowsSetClipboard (opts = {}) { b64Content, contentType = CONTENT_TYPE.plaintext, } = requireArgs(['b64Content'], opts); - if (b64Content && Buffer.from(b64Content, 'base64').toString('base64') !== b64Content || !b64Content) { - throw new errors.InvalidArgumentError( - `The 'b64Content' argument must be a valid non-empty base64-encoded string` - ); + if (b64Content && Buffer.from(b64Content, 'base64').toString('base64') !== b64Content) { + throw new errors.InvalidArgumentError(`The 'b64Content' argument must be a valid base64-encoded string`); } switch (contentType) { case CONTENT_TYPE.plaintext: