Page 129 - Nodejs 교과서 개정2판
P. 129

୹۱غ঻णפ׮  ֢٘ח ౵ੌਸ ੍ਸ ٸ ݫݽܻী ౵ੌ ௼ӝ݅ఀ ҕрਸ ݃۲೧فݴ ౵ੌ ؘ੉ఠܳ ݫݽܻী ੷

         ੢ೠ ٍ ࢎਊ੗о ઑ੘ೡ ࣻ ੓ب۾ ೤פ׮  ੉ٸ ݫݽܻী ੷੢ػ ؘ੉ఠо ߄۽ ߡಌੑפ׮














         § Ӓܿ      ߡಌ



         ৈӝী ߡಌܳ ૒੽ ׮ܙ ࣻ ੓ח ௿ېझо ੓णפ׮  ߄۽ Bufferੑפ׮

          buffer.js

           const	buffer	=	Buffer.from('저를	버퍼로	바꿔보세요');
           console.log('from():',	buffer);
           console.log('length:',	buffer.length);
           console.log('toString():',	buffer.toString());


           const	array	=	[Buffer.from('띄엄	'),	Buffer.from('띄엄	'),	Buffer.from('띄어쓰기')];
           const	buffer2	=	Buffer.concat(array);
           console.log('concat():',	buffer2.toString());


           const	buffer3	=	Buffer.alloc(5);
           console.log('alloc():',	buffer3);




          콘솔
           $	node	buffer
           from():	<Buffer	ec	a0	80	eb	a5	bc	20	eb	b2	84	ed	8d	bc	eb	a1	9c	20	eb	b0	94	ea	bf	94	eb	b3	b4	ec	84	b8	ec	9
           a	94>
           length:	32
           toString():	저를	버퍼로	바꿔보세요
           concat():	띄엄	띄엄	띄어쓰기
           alloc():	<Buffer	00	00	00	00	00>




         Buffer ё୓ח ৈ۞ о૑ ݫࢲ٘ܳ ઁҕ೤פ׮


            • from(문자열)  ޙ੗ৌਸ ߡಌ۽ ߄Ե ࣻ ੓णפ׮  length ࣘࢿ਷ ߡಌ੄ ௼ӝܳ ঌ݀פ׮  ߄੉౟ ױਤੑ
             פ׮

            • toString(버퍼)  ߡಌܳ ׮द ޙ੗ৌ۽ ߄Ե ࣻ ੓णפ׮  ੉ٸ CBTF  ա IFYܳ ੋࣻ۽ ֍ਵݶ ೧׼ ੋ௏
             ٬ਵ۽ب ߸ജ оמ೤פ׮
   124   125   126   127   128   129   130   131   132   133   134