Mercurial > hg > nginx-site
comparison xml/en/docs/njs/reference.xml @ 2609:99bd2ae8d2be
Added Buffer to njs Reference.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Thu, 08 Oct 2020 11:36:19 +0100 |
parents | 0ec1e1b063d7 |
children | 6fdefb00858f |
comparison
equal
deleted
inserted
replaced
2608:249ae2577aac | 2609:99bd2ae8d2be |
---|---|
870 | 870 |
871 | 871 |
872 <section id="built-in" name="Built-in Modules"> | 872 <section id="built-in" name="Built-in Modules"> |
873 | 873 |
874 | 874 |
875 <section id="buffer" name="Buffer"> | |
876 | |
877 <para> | |
878 <list type="tag"> | |
879 | |
880 <tag-name id="buffer_alloc"><literal>Buffer.alloc(<value>size</value>[, | |
881 <value>fill</value>[, | |
882 <value>encoding</value>]]))</literal></tag-name> | |
883 <tag-desc> | |
884 <para> | |
885 Allocates a new Buffer of a specified <value>size</value>. | |
886 If <value>fill</value> is not specified, the Buffer will be zero-filled. | |
887 If <value>fill</value> is specified, | |
888 the allocated Buffer will be initialized by calling | |
889 <link id="buf_fill"><literal>buf.fill(fill)</literal></link>. | |
890 If <value>fill</value> and <value>encoding</value> are specified, | |
891 the allocated Buffer will be initialized by calling | |
892 <link id="buf_fill"><literal>buf.fill(fill, | |
893 encoding)</literal></link>. | |
894 </para> | |
895 | |
896 <para> | |
897 The <value>fill</value> parameter may be a | |
898 <value>string</value>, | |
899 <value>Buffer</value>, | |
900 <value>Uint8Array</value>, or | |
901 <value>integer</value>. | |
902 </para> | |
903 </tag-desc> | |
904 | |
905 <tag-name id="buffer_alloc_unsafe"><literal>Buffer.allocUnsafe(<value>size</value>)</literal></tag-name> | |
906 <tag-desc> | |
907 <para> | |
908 The same as | |
909 <link id="buffer_alloc"><literal>Buffer.alloc()</literal></link>, | |
910 with the difference that the memory allocated for the buffer is not initialized, | |
911 the contents of the new buffer is unknown and may contain sensitive data. | |
912 </para> | |
913 </tag-desc> | |
914 | |
915 <tag-name id="buffer_bytelength"><literal>Buffer.byteLength(<value>value</value>[, | |
916 <value>encoding</value>])</literal></tag-name> | |
917 <tag-desc> | |
918 Returns the byte length of a specified value, | |
919 when encoded using <value>encoding</value>. | |
920 The value can be a | |
921 <literal>string</literal>, | |
922 <literal>Buffer</literal>, | |
923 <literal>TypedArray</literal>, | |
924 <literal>DataView</literal>, or | |
925 <literal>ArrayBuffer</literal>. | |
926 If the value is a <value>string</value>, | |
927 the <literal>encoding</literal> parameter is its encoding, can be | |
928 <value>utf-8</value>, | |
929 <value>hex</value>, | |
930 <value>base64</value>, | |
931 <value>base64url</value>; | |
932 by default is <value>utf-8</value>. | |
933 </tag-desc> | |
934 | |
935 <tag-name id="buffer_compare"><literal>Buffer.compare(<value>buffer1</value>, | |
936 <value>buffer2</value>)</literal></tag-name> | |
937 <tag-desc> | |
938 Compares <value>buffer1</value> with <value>buffer2</value> | |
939 when sorting arrays of Buffer instances. | |
940 Returns | |
941 <literal>0</literal> if | |
942 <value>buffer1</value> is the same as <value>buffer2</value>, | |
943 <literal>1</literal> if | |
944 <value>buffer2</value> should come before <value>buffer1</value> when sorted, or | |
945 <literal>-1</literal> if | |
946 <value>buffer2</value> should come after <value>buffer1</value> when sorted. | |
947 </tag-desc> | |
948 | |
949 <tag-name id="buffer_concat"><literal>Buffer.concat(<value>list</value>[, | |
950 <value>totalLength</value>])</literal></tag-name> | |
951 <tag-desc> | |
952 Returns a new Buffer | |
953 which is the result of concatenating all the Buffer instances in the list. | |
954 If there are no items in the list or the total length is 0, | |
955 a new zero-length Buffer is returned. | |
956 If <value>totalLength</value> is not specified, | |
957 it is calculated from the Buffer instances in list by adding their lengths. | |
958 If <value>totalLength</value> is specified, | |
959 it is coerced to an unsigned integer. | |
960 If the combined length of the Buffers in list exceeds | |
961 <value>totalLength</value>, | |
962 the result is truncated to <value>totalLength</value>. | |
963 </tag-desc> | |
964 | |
965 <tag-name id="buffer_from_array"><literal>Buffer.from(<value>array</value>)</literal></tag-name> | |
966 <tag-desc> | |
967 Allocates a new Buffer using an array of bytes | |
968 in the range <literal>0</literal> – <literal>255</literal>. | |
969 Array entries outside that range will be truncated. | |
970 </tag-desc> | |
971 | |
972 <tag-name id="buffer_from_buffer"><literal>Buffer.from(<value>buffer</value>)</literal></tag-name> | |
973 <tag-desc> | |
974 Copies the passed buffer data onto a new Buffer instance. | |
975 </tag-desc> | |
976 | |
977 <tag-name id="buffer_from_object"><literal>Buffer.from(<value>object</value>[, | |
978 <value>offsetOrEncoding</value>[, | |
979 <value>length</value>]])</literal></tag-name> | |
980 <tag-desc> | |
981 For objects whose <literal>valueOf()</literal> function | |
982 returns a value not strictly equal to object, | |
983 returns | |
984 <literal>Buffer.from(object.valueOf()</literal>, | |
985 <literal>offsetOrEncoding</literal>, | |
986 <literal>length</literal>). | |
987 </tag-desc> | |
988 | |
989 <tag-name id="buffer_from_string"><literal>Buffer.from(<value>string</value>[, | |
990 <value>encoding</value>])</literal></tag-name> | |
991 <tag-desc> | |
992 Creates a new Buffer with a <value>string</value>. | |
993 The <value>encoding</value> parameter identifies the character encoding | |
994 to be used when converting a string into bytes. | |
995 The encoding can be | |
996 <literal>utf-8</literal>, | |
997 <literal>hex</literal>, | |
998 <literal>base64</literal>, | |
999 <literal>base64url</literal>; | |
1000 by default is <literal>utf-8</literal>. | |
1001 </tag-desc> | |
1002 | |
1003 <tag-name id="buffer_is_buffer"><literal>Buffer.isBuffer(<value>object</value>)</literal></tag-name> | |
1004 <tag-desc> | |
1005 A boolean value, | |
1006 returns <literal>true</literal> if <value>object</value> is a Buffer. | |
1007 </tag-desc> | |
1008 | |
1009 <tag-name id="buffer_is_encoding"><literal>Buffer.isEncoding(<value>encoding</value>)</literal></tag-name> | |
1010 <tag-desc> | |
1011 A boolean value, | |
1012 returns <literal>true</literal> | |
1013 if encoding is the name of a supported character encoding. | |
1014 </tag-desc> | |
1015 | |
1016 <tag-name id="buf_index"><literal>buffer[<value>index</value>]</literal></tag-name> | |
1017 <tag-desc> | |
1018 The index operator <value>index</value> | |
1019 can be used to get and set the octet at position index in | |
1020 <literal>buffer</literal>. | |
1021 The values refer to individual bytes, | |
1022 so the legal value range is between 0 and 255 (decimal). | |
1023 </tag-desc> | |
1024 | |
1025 <tag-name id="buf_buffer"><literal>buf.buffer</literal></tag-name> | |
1026 <tag-desc> | |
1027 The underlying <literal>ArrayBuffer</literal> object | |
1028 based on which this Buffer object is created. | |
1029 </tag-desc> | |
1030 | |
1031 <tag-name id="buf_byte_offset"><literal>buf.byteOffset</literal></tag-name> | |
1032 <tag-desc> | |
1033 An integer, | |
1034 specifying the <literal>byteOffset</literal> of the Buffers | |
1035 underlying <literal>ArrayBuffer</literal> object. | |
1036 </tag-desc> | |
1037 | |
1038 <tag-name id="buf_compare"><literal>buf.compare(<value>target</value>[, | |
1039 <value>targetStart</value>[, | |
1040 <value>targetEnd</value>[, | |
1041 <value>sourceStart</value>[, | |
1042 <value>sourceEnd</value>]]]])</literal></tag-name> | |
1043 <tag-desc> | |
1044 Compares buffer with target and returns a number | |
1045 indicating whether buffer comes before, after, or is the same | |
1046 as target in sort order. | |
1047 Comparison is based on the actual sequence of bytes in each Buffer. | |
1048 The <literal>targetStart</literal> is an integer specifying the offset | |
1049 within target at which to begin comparison, | |
1050 by default is 0. | |
1051 The <literal>targetEnd</literal> is an integer specifying the offset | |
1052 within target at which to end comparison, | |
1053 by default is <literal>target.length</literal>. | |
1054 The <literal>sourceStart</literal> is an integer specifying the offset | |
1055 within buffer at which to begin comparison, | |
1056 by default is 0. | |
1057 The <literal>sourceEnd</literal> is an integer specifying the offset | |
1058 within buffer at which to end comparison (not inclusive), | |
1059 by default is <literal>buf.length</literal>. | |
1060 </tag-desc> | |
1061 | |
1062 <tag-name id="buf_copy"><literal>buf.copy(<value>target</value>[, | |
1063 <value>targetStart</value>[, | |
1064 <value>sourceStart</value>[, | |
1065 <value>sourceEnd</value>]]])</literal></tag-name> | |
1066 <tag-desc> | |
1067 Copies data from a region of buffer to a region in target, | |
1068 even if the target memory region overlaps with buffer. | |
1069 The <literal>target</literal> parameter is a | |
1070 <value>Buffer</value> or <value>Uint8Array</value> to copy into. | |
1071 | |
1072 <para> | |
1073 The <literal>targetStart</literal> is an integer specifying the offset | |
1074 within target at which to begin writing, | |
1075 by default is 0. | |
1076 The <literal>sourceStart</literal> is an integer specifying the offset | |
1077 within buffer from which to begin copying, | |
1078 by default is 0. | |
1079 The <literal>sourceEnd</literal> is an integer specifying the offset | |
1080 within buffer at which to stop copying (not inclusive) | |
1081 by default is <value>buf.length</value>. | |
1082 </para> | |
1083 </tag-desc> | |
1084 | |
1085 <tag-name id="buf_equals"><literal>buf.equals(<value>otherBuffer</value>)</literal></tag-name> | |
1086 <tag-desc> | |
1087 A boolean value, | |
1088 returns <literal>true</literal> if both Buffer and <value>otherBuffer</value> | |
1089 have exactly the same bytes. | |
1090 </tag-desc> | |
1091 | |
1092 <tag-name id="buf_fill"><literal>buf.fill(<value>value</value>[, | |
1093 <value>offset</value>[, | |
1094 <value>end</value>]][, | |
1095 <value>encoding</value>])</literal></tag-name> | |
1096 <tag-desc> | |
1097 Fills the Buffer with the specified <value>value</value>. | |
1098 If the <value>offset</value> and <value>end</value> are not specified, | |
1099 the entire Buffer will be filled. | |
1100 The <value>value</value> is coerced to <value>uint32</value> if it is not a | |
1101 <literal>string</literal>, | |
1102 <literal>Buffer</literal>, or | |
1103 <literal>integer</literal>. | |
1104 If the resulting integer is greater than 255, | |
1105 the Buffer will be filled with <value>value</value> and 255. | |
1106 </tag-desc> | |
1107 | |
1108 <tag-name id="buf_includes"><literal>buf.includes(<value>value</value>[, | |
1109 <value>byteOffset</value>][, | |
1110 <value>encoding</value>])</literal></tag-name> | |
1111 <tag-desc> | |
1112 Equivalent to | |
1113 <link id="buf_indexof"><literal>buf.indexOf()</literal></link> | |
1114 <literal>!== -1</literal>, | |
1115 returns <literal>true</literal> if the <value>value</value> was found | |
1116 in Buffer. | |
1117 </tag-desc> | |
1118 | |
1119 <tag-name id="buf_indexof"><literal>buf.indexOf(<value>value</value>[, | |
1120 <value>byteOffset</value>][, | |
1121 <value>encoding</value>])</literal></tag-name> | |
1122 <tag-desc> | |
1123 Returns an integer which is the index of the first occurrence of | |
1124 <value>value</value> in Buffer, or <value>-1</value> | |
1125 if Buffer does not contain value. | |
1126 The <value>value</value> can be a | |
1127 <literal>string</literal> with specified <value>encoding</value> | |
1128 (by default <value>utf-8</value>), | |
1129 <literal>Buffer</literal>, | |
1130 <literal>Unit8Array</literal>, | |
1131 or a number between 0 and 255. | |
1132 </tag-desc> | |
1133 | |
1134 <tag-name id="buf_lastindexof"><literal>buf.lastIndexOf(<value>value</value>[, | |
1135 <value>byteOffset</value>][, | |
1136 <value>encoding</value>])</literal></tag-name> | |
1137 <tag-desc> | |
1138 The same as | |
1139 <link id="buf_indexof"><literal>buf.indexOf()</literal></link>, | |
1140 except the last occurrence of the <value>value</value> is found | |
1141 instead of the first occurrence. | |
1142 The <value>value</value> can be a string, Buffer, or | |
1143 integer between 1 and 255. | |
1144 If the <value>value</value> is an empty string or empty Buffer, | |
1145 <literal>byteOffset</literal> will be returned. | |
1146 </tag-desc> | |
1147 | |
1148 <tag-name id="buf_length"><literal>buf.length</literal></tag-name> | |
1149 <tag-desc> | |
1150 Returns the number of bytes in Buffer. | |
1151 </tag-desc> | |
1152 | |
1153 <tag-name id="buf_readintbe"><literal>buf.readIntBE(<value>offset</value>, | |
1154 <value>byteLength</value>)</literal></tag-name> | |
1155 <tag-desc> | |
1156 Reads the <value>byteLength</value> from <literal>buf</literal> | |
1157 at the specified <value>offset</value> | |
1158 and interprets the result as a big-endian, | |
1159 two's complement signed value supporting up to 48 bits of accuracy. | |
1160 The <value>byteLength</value> parameter is an integer between 1 and 6 | |
1161 specifying the number of bytes to read. | |
1162 <para> | |
1163 The similar methods are also supported: | |
1164 <literal>buf.readInt8([offset])</literal>, | |
1165 <literal>buf.readInt16BE([offset])</literal>, | |
1166 <literal>buf.readInt32BE([offset])</literal>. | |
1167 </para> | |
1168 </tag-desc> | |
1169 | |
1170 <tag-name id="buf_readintle"><literal>buf.readIntLE(<value>offset</value>, | |
1171 <value>byteLength</value>)</literal></tag-name> | |
1172 <tag-desc> | |
1173 Reads the <value>byteLength</value> from <literal>buf</literal> | |
1174 at the specified <value>offset</value> | |
1175 and interprets the result as a little-endian, | |
1176 two's complement signed value supporting up to 48 bits of accuracy. | |
1177 The <value>byteLength</value> parameter is an integer between 1 and 6 | |
1178 specifying the number of bytes to read. | |
1179 <para> | |
1180 The similar methods are also supported: | |
1181 <literal>buf.readInt8([offset])</literal>, | |
1182 <literal>buf.readInt16LE([offset])</literal>, | |
1183 <literal>buf.readInt32LE([offset])</literal>. | |
1184 </para> | |
1185 </tag-desc> | |
1186 | |
1187 <tag-name id="buf_readuintbe"><literal>buf.readUIntBE(<value>offset</value>, | |
1188 <value>byteLength</value>)</literal></tag-name> | |
1189 <tag-desc> | |
1190 Reads the <value>byteLength</value> from <literal>buf</literal> | |
1191 at the specified <value>offset</value> | |
1192 and interprets the result as a big-endian | |
1193 integer supporting up to 48 bits of accuracy. | |
1194 The <value>byteLength</value> parameter is an integer between 1 and 6 | |
1195 specifying the number of bytes to read. | |
1196 <para> | |
1197 The similar methods are also supported: | |
1198 <literal>buf.readUInt8([offset])</literal>, | |
1199 <literal>buf.readUInt16BE([offset])</literal>, | |
1200 <literal>buf.readUInt32BE([offset])</literal>. | |
1201 </para> | |
1202 </tag-desc> | |
1203 | |
1204 <tag-name id="buf_readuintle"><literal>buf.readUIntLE(<value>offset</value>, | |
1205 <value>byteLength</value>)</literal></tag-name> | |
1206 <tag-desc> | |
1207 Reads the <value>byteLength</value> from <literal>buf</literal> | |
1208 at the specified <value>offset</value> | |
1209 and interprets the result as a little-endian | |
1210 integer supporting up to 48 bits of accuracy. | |
1211 The <value>byteLength</value> parameter is an integer between 1 and 6 | |
1212 specifying the number of bytes to read. | |
1213 <para> | |
1214 The similar methods are also supported: | |
1215 <literal>buf.readUInt8([offset])</literal>, | |
1216 <literal>buf.readUInt16LE([offset])</literal>, | |
1217 <literal>buf.readUInt32LE([offset])</literal>. | |
1218 </para> | |
1219 </tag-desc> | |
1220 | |
1221 <tag-name id="buf_readdobulebe"><literal>buf.readDoubleBE</literal>([<value>offset</value>])</tag-name> | |
1222 <tag-desc> | |
1223 Reads a 64-bit, big-endian double from <literal>buf</literal> | |
1224 at the specified <value>offset</value>. | |
1225 </tag-desc> | |
1226 | |
1227 <tag-name id="buf_readdobulele"><literal>buf.readDoubleLE</literal>([<value>offset</value>])</tag-name> | |
1228 <tag-desc> | |
1229 Reads a 64-bit, little-endian double from <literal>buf</literal> | |
1230 at the specified <value>offset</value>. | |
1231 </tag-desc> | |
1232 | |
1233 <tag-name id="buf_readfloatbe"><literal>buf.readFloatBE</literal>([<value>offset</value>])</tag-name> | |
1234 <tag-desc> | |
1235 Reads a 32-bit, big-endian float from <literal>buf</literal> | |
1236 at the specified <value>offset</value>. | |
1237 </tag-desc> | |
1238 | |
1239 <tag-name id="buf_readfloatle"><literal>buf.readFloatLE</literal>([<value>offset</value>])</tag-name> | |
1240 <tag-desc> | |
1241 Reads a 32-bit, little-endian float from <literal>buf</literal> | |
1242 at the specified <value>offset</value>. | |
1243 </tag-desc> | |
1244 | |
1245 <tag-name id="buf_subarray"><literal>buf.subarray[<value>start</value>[, | |
1246 <value>end</value>]])</literal></tag-name> | |
1247 <tag-desc> | |
1248 Returns a new <literal>buf</literal> | |
1249 that references the same memory as the original, | |
1250 but offset and cropped by | |
1251 <value>start</value> and <value>end</value>. | |
1252 If <value>end</value> is greater than | |
1253 <link id="buf_length"><literal>buf.length</literal></link>, | |
1254 the same result as that of end equal to | |
1255 <link id="buf_length"><literal>buf.length</literal></link> | |
1256 is returned. | |
1257 </tag-desc> | |
1258 | |
1259 <tag-name id="buf_slice"><literal>buf.slice[<value>start</value>[, | |
1260 <value>end</value>]])</literal></tag-name> | |
1261 <tag-desc> | |
1262 Returns a new <literal>buf</literal> | |
1263 that references the same memory as the original, | |
1264 but offset and cropped by the | |
1265 <value>start</value> and <value>end</value> values. | |
1266 The method is not compatible with the | |
1267 <literal>Uint8Array.prototype.slice()</literal>, | |
1268 which is a superclass of Buffer. | |
1269 To copy the slice, use | |
1270 <literal>Uint8Array.prototype.slice()</literal>. | |
1271 </tag-desc> | |
1272 | |
1273 <tag-name id="buf_swap16"><literal>buf.swap16</literal>()</tag-name> | |
1274 <tag-desc> | |
1275 Interprets <literal>buf</literal> as an array of unsigned 16-bit numbers | |
1276 and swaps the byte order in-place. | |
1277 Throws an error if | |
1278 <link id="buf_length"><literal>buf.length</literal></link> | |
1279 is not a multiple of 2. | |
1280 </tag-desc> | |
1281 | |
1282 <tag-name id="buf_swap32"><literal>buf.swap32</literal>()</tag-name> | |
1283 <tag-desc> | |
1284 Interprets <literal>buf</literal> as an array of unsigned 32-bit numbers | |
1285 and swaps the byte order in-place. | |
1286 Throws an error if | |
1287 <link id="buf_length"><literal>buf.length</literal></link> | |
1288 is not a multiple of 4. | |
1289 </tag-desc> | |
1290 | |
1291 <tag-name id="buf_swap64"><literal>buf.swap64</literal>()</tag-name> | |
1292 <tag-desc> | |
1293 Interprets <literal>buf</literal> as an array of 64-bit numbers | |
1294 and swaps byte order in-place. | |
1295 Throws an error if | |
1296 <link id="buf_length"><literal>buf.length</literal></link> | |
1297 is not a multiple of 8. | |
1298 </tag-desc> | |
1299 | |
1300 <tag-name id="buf_tojson"><literal>buf.toJSON</literal>()</tag-name> | |
1301 <tag-desc> | |
1302 Returns a JSON representation of <literal>buf.</literal> | |
1303 <literal>JSON.stringify()</literal> | |
1304 implicitly calls this function when stringifying a Buffer instance. | |
1305 </tag-desc> | |
1306 | |
1307 <tag-name id="buf_tostring"><literal>buf.toString([<value>encoding</value>[, | |
1308 <value>start</value>[, | |
1309 <value>end</value>]]])</literal></tag-name> | |
1310 <tag-desc> | |
1311 Decodes <literal>buf</literal> to a string | |
1312 according to the specified character <value>encoding</value>. | |
1313 which can be <value>utf-8</value>, | |
1314 <value>hex</value>, | |
1315 <value>base64</value>, | |
1316 <value>base64url</value>. | |
1317 The <value>start</value> and <value>end</value> parameters | |
1318 may be passed to decode only a subset of Buffer. | |
1319 </tag-desc> | |
1320 | |
1321 <tag-name id="buf_write"><literal>buf.write(<value>string</value>[, | |
1322 <value>offset</value>[, | |
1323 <value>length</value>]][, | |
1324 <value>encoding</value>])</literal></tag-name> | |
1325 <tag-desc> | |
1326 Writes a <value>string</value> to <literal>buf</literal> | |
1327 at <value>offset</value> | |
1328 according to the character <value>encoding</value>. | |
1329 The <value>length</value> parameter is the number of bytes to write. | |
1330 If Buffer did not contain enough space to fit the entire string, | |
1331 only part of string will be written, | |
1332 however, partially encoded characters will not be written. | |
1333 The <value>encoding</value> can be | |
1334 <value>utf-8</value>, | |
1335 <value>hex</value>, | |
1336 <value>base64</value>, | |
1337 <value>base64url</value>. | |
1338 </tag-desc> | |
1339 | |
1340 <tag-name id="buf_writeintbe"><literal>buf.writeIntBE(<value>value</value>, | |
1341 <value>offset</value>, | |
1342 <value>byteLength</value>)</literal></tag-name> | |
1343 <tag-desc> | |
1344 Writes <value>byteLength</value> bytes of <value>value</value> | |
1345 to <literal>buf</literal> | |
1346 at the specified <value>offset</value> as big-endian. | |
1347 Supports up to 48 bits of accuracy. | |
1348 The <value>byteLength</value> parameter is an integer between 1 and 6 | |
1349 specifying the number of bytes to read. | |
1350 <para> | |
1351 The following similar methods are also supported: | |
1352 <literal>buf.writeInt8</literal>, | |
1353 <literal>buf.writeInt16BE</literal>, | |
1354 <literal>buf.writeInt32BE</literal>. | |
1355 </para> | |
1356 </tag-desc> | |
1357 | |
1358 <tag-name id="buf_writeintle"><literal>buf.writeIntLE(<value>value</value>, | |
1359 <value>offset</value>, | |
1360 <value>byteLength</value>)</literal></tag-name> | |
1361 <tag-desc> | |
1362 Writes <value>byteLength</value> bytes of <value>value</value> | |
1363 to <literal>buf</literal> | |
1364 at the specified <value>offset</value> as little-endian. | |
1365 Supports up to 48 bits of accuracy. | |
1366 The <value>byteLength</value> parameter is an integer between 1 and 6 | |
1367 specifying the number of bytes to read. | |
1368 <para> | |
1369 The following similar methods are also supported: | |
1370 <literal>buf.writeInt8</literal>, | |
1371 <literal>buf.writeInt16LE</literal>, | |
1372 <literal>buf.writeInt32LE</literal>. | |
1373 </para> | |
1374 </tag-desc> | |
1375 | |
1376 <tag-name id="buf_writeuintbe"><literal>buf.writeUIntBE(<value>value</value>, | |
1377 <value>offset</value>, | |
1378 <value>byteLength</value>)</literal></tag-name> | |
1379 <tag-desc> | |
1380 Writes <value>byteLength</value> bytes of <value>value</value> | |
1381 to <literal>buf</literal> | |
1382 at the specified <value>offset</value> as big-endian. | |
1383 Supports up to 48 bits of accuracy. | |
1384 The <value>byteLength</value> parameter is an integer between 1 and 6 | |
1385 specifying the number of bytes to read. | |
1386 <para> | |
1387 The following similar methods are also supported: | |
1388 <literal>buf.writeUInt8</literal>, | |
1389 <literal>buf.writeUInt16BE</literal>, | |
1390 <literal>buf.writeUInt32BE</literal>. | |
1391 </para> | |
1392 </tag-desc> | |
1393 | |
1394 <tag-name id="buf_writeuintle"><literal>buf.writeUIntLE(<value>value</value>, | |
1395 <value>offset</value>, | |
1396 <value>byteLength</value>)</literal></tag-name> | |
1397 <tag-desc> | |
1398 Writes <value>byteLength</value> bytes of <value>value</value> | |
1399 to <literal>buf</literal> | |
1400 at the specified <value>offset</value> as little-endian. | |
1401 Supports up to 48 bits of accuracy. | |
1402 The <value>byteLength</value> parameter is an integer between 1 and 6 | |
1403 specifying the number of bytes to read. | |
1404 <para> | |
1405 The following similar methods are also supported: | |
1406 <literal>buf.writeUInt8</literal>, | |
1407 <literal>buf.writeUInt16LE</literal>, | |
1408 <literal>buf.writeUInt32LE</literal>. | |
1409 </para> | |
1410 </tag-desc> | |
1411 | |
1412 <tag-name id="buf_writedoublebe"><literal>buf.writeDoubleBE(<value>value</value>, | |
1413 [<value>offset</value>])</literal></tag-name> | |
1414 <tag-desc> | |
1415 Writes the <value>value</value> to <literal>buf</literal> | |
1416 at the specified <value>offset</value> as big-endian. | |
1417 </tag-desc> | |
1418 | |
1419 <tag-name id="buf_writedoublele"><literal>buf.writeDoubleLE(<value>value</value>, | |
1420 [<value>offset</value>])</literal></tag-name> | |
1421 <tag-desc> | |
1422 Writes the <value>value</value> to <literal>buf</literal> | |
1423 at the specified <value>offset</value> as little-endian. | |
1424 </tag-desc> | |
1425 | |
1426 <tag-name id="buf_writefloatbe"><literal>buf.writeFloatBE(<value>value</value>, | |
1427 [<value>offset</value>])</literal></tag-name> | |
1428 <tag-desc> | |
1429 Writes the <value>value</value> to <literal>buf</literal> | |
1430 at the specified <value>offset</value> as big-endian. | |
1431 </tag-desc> | |
1432 | |
1433 <tag-name id="buf_writefloatle"><literal>buf.writeFloatLE(<value>value</value>, | |
1434 [<value>offset</value>])</literal></tag-name> | |
1435 <tag-desc> | |
1436 Writes the <value>value</value> to <literal>buf</literal> | |
1437 at the specified <value>offset</value> as little-endian. | |
1438 </tag-desc> | |
1439 | |
1440 </list> | |
1441 </para> | |
1442 | |
1443 </section> | |
1444 | |
1445 | |
875 <section id="crypto" name="Crypto"> | 1446 <section id="crypto" name="Crypto"> |
876 | 1447 |
877 <para> | 1448 <para> |
878 The Crypto module provides cryptographic functionality support. | 1449 The Crypto module provides cryptographic functionality support. |
879 The Crypto module object is returned by <literal>require('crypto')</literal>. | 1450 The Crypto module object is returned by <literal>require('crypto')</literal>. |