w10schools
Login Register
  • Home
  • Tutorials
    • HTML, CSS
      • HTML, HTML5
      • CSS, CSS3
    • XML
    • JavaScript, AJAX
    • PHP
    • Ruby on Rails
      • Ruby
      • Rails
    • ASP.NET
      • ASP
      • C# .NET
    • Java
      • JSP
    • Databases
      • MySQL
      • MSSQL Server
      • Oracle
    • Web Server
      • Windows
      • Linux
      • Apache
      • IIS
    • Design
      • Dreamweaver
      • Flash
      • Photoshop
      • Fireworks
      • CorelDRAW
      • Illustrator
  • References
    • HTML
      • Bootstrap
    • CSS
      • CSS Selectors
      • Sass
    • JavaScript
    • Mobile Apps
      • Cordova
    • Ruby on Rails
      • Ruby
      • Rails
    • PHP
      • Function
      • Language
      • CodeIgniter
      • Phalcon
      • PHPUnit
      • Symfony
      • Drupal
      • Yii
      • Laravel
    • Perl
      • Perl
    • Python
      • Python
      • Django
      • NumPy
      • Pandas
      • scikit-image
      • scikit-learn
      • Statsmodels
      • Matplotlib
    • Lua
      • Lua
    • C, C++
      • C
      • C++
    • Server
      • Docker
      • Apache HTTP Server
      • Nginx
    • Database
      • PostgreSQL
    • Big Data
      • TensorFlow
    • Game Development
      • Phaser
      • LÖVE
  • Articles
    • News
    • General
      • Website Promotion
      • Online Advertising
      • Make Money Online
    • Editorials
    • Interviews
    • Web Roundups
  • Resources
    • Design
      • Fonts
      • Graphics
      • Vectors
      • Templates
      • UI (User Interface)
      • Brushes
      • Patterns, Backgrounds
      • Textures
    • Web Development
      • HTML, CSS
      • XML
      • JavaScript, AJAX
      • Ruby on Rails
      • PHP
      • Java
      • .NET
      • Python
      • Perl
      • Flash
    • Mobile Application Development
      • Mobile Development Tools
      • Swift
    • Online Services
      • Online Storage
      • Web Hosting
  • Tools
    • Generators
Edit
In Place Editing Advanced Editing
  • References
  • JavaScript
  • Node.js
  • Buffer

Buffer.compare()

Class Method: Buffer.compare(buf1, buf2)

  • buf1 <Buffer>
  • buf2 <Buffer>
  • Return: <Number>

Compares buf1 to buf2 typically for the purpose of sorting arrays of Buffers. This is equivalent is calling buf1.compare(buf2).

const arr = [Buffer.from('1234'), Buffer.from('0123')];
arr.sort(Buffer.compare);
Links:
  • https://nodejs.org/dist/latest-v5.x/docs/api/buffer.html#buffer_class_method_buffer_compare_buf1_buf2
doc_Nodejs
doc_Nodejs
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.

Popular Articles
buffer.compare() buf.compare(otherBuffer) otherBuffer <Buffer> Return: <Number> Compares two Buffer instances and returns a number indicating whether
Comparable#compare() compare (a, b) Numberprivate Defined in packages/ember-runtime/lib/mixins/comparable.js:21 Required. You must implement this method to apply this
Compare The concept Compare is a set of requirements expected by some of the standard library facilities from the user-provided function object types. The re
Comparator class Comparator Comparator. Methods string getTarget() Gets the target value. setTarget(string $target) Sets the target value. string
compare compare(idx1, op, idx2) Instance Public methods


Return to View
  • Facebook
  • Tweet
  • Digg it
  • Stumbleupon
  • Delicious
  • Plus Share

Designed by : w10schools

service@w10schools.com

Our Partners: aeeble – Providing content publishing and search solutions