zoukankan      html  css  js  c++  java
  • 珠峰-buffer-流事件

    #### Buffer

    // 字符串的二进制转10进制
    let r = parseInt('11111111', 2);
    console.log(r);
    // 打印 255
    // Number类型转为16进制
    let s = (255).toString(16);
    console.log(s);
    // 打印 ff
    
    
    let buffer = Buffer.from('你');
    console.log(buffer);
    // 打印<Buffer e4 bd a0>
    console.log(buffer.toString('base64'));
    // 打印5L2g
    
    // 把e4 bd a0 转为2进制,然后把24个数字分为4份,前边补充两个0,然后用自己的base64去翻译
    console.log((0xe4).toString(2)); // 11100100
    console.log((0xbd).toString(2)); // 10111101
    console.log((0xa0).toString(2)); // 10100000
    // 00111001 00001011 00110110 00100000
    
    console.log(parseInt('00111001', 2)) // 57
    console.log(parseInt('00001011', 2)) // 11
    console.log(parseInt('00110110',2)) // 54
    console.log(parseInt('00100000', 2)) // 32
    
    let str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    str += str.toLowerCase();
    str += '0123456789+/';
    console.log(str[57]+str[11]+str[54]+str[32]); // 5L2g
    

      

    #### buffer 的concat

    ##### 流

  • 相关阅读:
    python requests模块
    python 模拟豆瓣登录(豆瓣6.0)
    python 抓取糗事百科糗图
    python bz2模块
    the python challenge闯关记录(9-16)
    python之PIL库(Image模块)
    python之zipfile
    python之pickle模块
    the python challenge闯关记录(0-8)
    KVO简介
  • 原文地址:https://www.cnblogs.com/coding4/p/11521427.html
Copyright © 2011-2022 走看看