← 返回首页
GitHub - browserify/to-buffer: Pass in a string, get a buffer back. Pass in a buffer, get the same buffer back. · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

browserify/to-buffer

Go to file
Code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
View all files

Repository files navigation

to-buffer

Pass in a string, array, Buffer, Data View, or Uint8Array, and get a Buffer back.

npm install to-buffer

Usage

var toBuffer = require('to-buffer'); console.log(toBuffer('hi')); // <Buffer 68 69> console.log(toBuffer(Buffer('hi'))); // <Buffer 68 69> console.log(toBuffer('6869', 'hex')); // <Buffer 68 69> console.log(toBuffer(43)); // throws

About

Pass in a string, get a buffer back. Pass in a buffer, get the same buffer back.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors

Footer

© 2026 GitHub, Inc.