Search the reference...
/
BuildDocsReferenceGuidesBlogDiscord/node:buffer/Buffer/lastIndexOfMlastIndexOfmethod
buffer.Buffer.lastIndexOflastIndexOf(value: string | number | Uint8ArrayArrayBufferLike>,byteOffset?: number,encoding?: BufferEncoding): number;Identical to buf.indexOf(), except the last occurrence of value is found rather than the first occurrence.import { Buffer } from 'node:buffer'; const buf = Buffer.from('this buffer is a buffer'); console.log(buf.lastIndexOf('this')); // Prints: 0 console.log(buf.lastIndexOf('buffer')); // Prints: 17 console.log(buf.lastIndexOf(Buffer.from('buffer'))); // Prints: 17 console.log(buf.lastIndexOf(97)); // Prints: 15 (97 is the decimal ASCII value for 'a') console.log(buf.lastIndexOf(Buffer.from('yolo'))); // Prints: -1 console.log(buf.lastIndexOf('buffer', 5)); // Prints: 5 console.log(buf.lastIndexOf('buffer', 4)); // Prints: -1 const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le'); console.log(utf16Buffer.lastIndexOf('\u03a3', undefined, 'utf16le')); // Prints: 6 console.log(utf16Buffer.lastIndexOf('\u03a3', -5, 'utf16le')); // Prints: 4 If value is not a string, number, or Buffer, this method will throw a TypeError. If value is a number, it will be coerced to a valid byte value, an integer between 0 and 255.If byteOffset is not a number, it will be coerced to a number. Any arguments that coerce to NaN, like {} or undefined, will search the whole buffer. This behavior matches String.prototype.lastIndexOf().import { Buffer } from 'node:buffer'; const b = Buffer.from('abcdef'); // Passing a value that's a number, but not a valid byte. // Prints: 2, equivalent to searching for 99 or 'c'. console.log(b.lastIndexOf(99.9)); console.log(b.lastIndexOf(256 + 99)); // Passing a byteOffset that coerces to NaN. // Prints: 1, searching the whole buffer. console.log(b.lastIndexOf('b', undefined)); console.log(b.lastIndexOf('b', {})); // Passing a byteOffset that coerces to 0. // Prints: -1, equivalent to passing 0. console.log(b.lastIndexOf('b', null)); console.log(b.lastIndexOf('b', [])); If value is an empty string or empty Buffer, byteOffset will be returned.@param valueWhat to search for.@param byteOffsetWhere to begin searching in buf. If negative, then offset is calculated from the end of buf.@param encodingIf value is a string, this is the encoding used to determine the binary representation of the string that will be searched for in buf.@returnsThe index of the last occurrence of value in buf, or -1 if buf does not contain value.lastIndexOf(value: string | number | Uint8ArrayArrayBufferLike>,encoding: BufferEncoding): number;Referenced typesclass Uint8ArrayTArrayBuffer extends ArrayBufferLike = ArrayBufferLike>A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised.readonly [Symbol.toStringTag]: 'Uint8Array'readonly buffer: TArrayBufferThe ArrayBuffer instance referenced by the array.readonly byteLength: numberThe length in bytes of the array.readonly byteOffset: numberThe offset in bytes of the array.readonly BYTES_PER_ELEMENT: numberThe size in bytes of each element in the array.readonly length: numberThe length of the array.[Symbol.iterator](): ArrayIteratornumber>;at(index: number): undefined | number;Returns the item located at the specified index.@param indexThe zero-based index of the desired code unit. A negative index will count back from the last item.copyWithin(target: number,start: number,end?: number): this;Returns the this object after copying a section of the array identified by start and end to the same array starting at position target@param targetIf target is negative, it is treated as length+target where length is the length of the array.@param startIf start is negative, it is treated as length+start. If end is negative, it is treated as length+end.@param endIf not specified, length of the this object is used as its default value.entries(): ArrayIterator[number, number]>;Returns an array of key, value pairs for every entry in the arrayevery(predicate: (value: number, index: number, array: this) => unknown,thisArg?: any): boolean;Determines whether all the members of an array satisfy the specified test.@param predicateA function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.@param thisArgAn object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.fill(value: number,start?: number,end?: number): this;Changes all array elements from start to end index to a static value and returns the modified array@param valuevalue to fill array section with@param startindex to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array.@param endindex to stop filling the array at. If end is negative, it is treated as length+end.filter(predicate: (value: number, index: number, array: this) => any,thisArg?: any): Uint8ArrayArrayBuffer>;Returns the elements of an array that meet the condition specified in a callback function.@param predicateA function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.@param thisArgAn object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.find(predicate: (value: number, index: number, obj: this) => boolean,thisArg?: any): undefined | number;Returns the value of the first element in the array where predicate is true, and undefined otherwise.@param predicatefind calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.@param thisArgIf provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.findIndex(predicate: (value: number, index: number, obj: this) => boolean,thisArg?: any): number;Returns the index of the first element in the array where predicate is true, and -1 otherwise.@param predicatefind calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.@param thisArgIf provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.findLastS extends number>(predicate: (value: number, index: number, array: this) => value is S,thisArg?: any): undefined | S;Returns the value of the last element in the array where predicate is true, and undefined otherwise.@param predicatefindLast calls predicate once for each element of the array, in descending order, until it finds one where predicate returns true. If such an element is found, findLast immediately returns that element value. Otherwise, findLast returns undefined.@param thisArgIf provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.findLast(predicate: (value: number, index: number, array: this) => unknown,thisArg?: any): undefined | number;findLastIndex(predicate: (value: number, index: number, array: this) => unknown,thisArg?: any): number;Returns the index of the last element in the array where predicate is true, and -1 otherwise.@param predicatefindLastIndex calls predicate once for each element of the array, in descending order, until it finds one where predicate returns true. If such an element is found, findLastIndex immediately returns that element index. Otherwise, findLastIndex returns -1.@param thisArgIf provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.forEach(callbackfn: (value: number, index: number, array: this) => void,thisArg?: any): void;Performs the specified action for each element in an array.@param callbackfnA function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.@param thisArgAn object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.includes(searchElement: number,fromIndex?: number): boolean;Determines whether an array includes a certain element, returning true or false as appropriate.@param searchElementThe element to search for.@param fromIndexThe position in this array at which to begin searching for searchElement.indexOf(searchElement: number,fromIndex?: number): number;Returns the index of the first occurrence of a value in an array.@param searchElementThe value to locate in the array.@param fromIndexThe array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.join(separator?: string): string;Adds all the elements of an array separated by the specified separator string.@param separatorA string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.keys(): ArrayIteratornumber>;Returns an list of keys in the arraylastIndexOf(searchElement: number,fromIndex?: number): number;Returns the index of the last occurrence of a value in an array.@param searchElementThe value to locate in the array.@param fromIndexThe array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.map(callbackfn: (value: number, index: number, array: this) => number,thisArg?: any): Uint8ArrayArrayBuffer>;Calls a defined callback function on each element of an array, and returns an array that contains the results.@param callbackfnA function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.@param thisArgAn object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: this) => number): number;Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.@param callbackfnA function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: this) => number,initialValue: number): number;reduceU>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: this) => U,initialValue: U): U;Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.@param callbackfnA function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.@param initialValueIf initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: this) => number): number;Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.@param callbackfnA function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: this) => number,initialValue: number): number;reduceRightU>(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: this) => U,initialValue: U): U;Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.@param callbackfnA function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.@param initialValueIf initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.reverse(): this;Reverses the elements in an Array.set(array: ArrayLikenumber>,offset?: number): void;Sets a value or an array of values.@param arrayA typed or untyped array of values to set.@param offsetThe index in the current array at which the values are to be written.setFromBase64(base64: string,offset?: number): { read: number; written: number };Set the contents of the Uint8Array from a base64 encoded string@param base64The base64 encoded string to decode into the array@param offsetOptional starting index to begin setting the decoded bytes (default: 0)setFromHex(hex: string): { read: number; written: number };Set the contents of the Uint8Array from a hex encoded string@param hexThe hex encoded string to decode into the array. The string must have an even number of characters, be valid hexadecimal characters and contain no whitespace.slice(start?: number,end?: number): Uint8ArrayArrayBuffer>;Returns a section of an array.@param startThe beginning of the specified portion of the array.@param endThe end of the specified portion of the array. This is exclusive of the element at the index 'end'.some(predicate: (value: number, index: number, array: this) => unknown,thisArg?: any): boolean;Determines whether the specified callback function returns true for any element of an array.@param predicateA function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.@param thisArgAn object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.sort(compareFn?: (a: number, b: number) => number): this;Sorts an array.@param compareFnFunction used to determine the order of the elements. It is expected to return a negative value if first argument is less than second argument, zero if they're equal and a positive value otherwise. If omitted, the elements are sorted in ascending order.[11,2,22,1].sort((a, b) => a - b) subarray(begin?: number,end?: number): Uint8ArrayTArrayBuffer>;Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements at begin, inclusive, up to end, exclusive.@param beginThe index of the beginning of the array.@param endThe index of the end of the array.toBase64(options?: { alphabet: 'base64' | 'base64url'; omitPadding: boolean }): string;Convert the Uint8Array to a base64 encoded string@returnsThe base64 encoded string representation of the Uint8ArraytoHex(): string;Convert the Uint8Array to a hex encoded string@returnsThe hex encoded string representation of the Uint8ArraytoLocaleString(): string;Converts a number to a string by using the current locale.toLocaleString(locales: string | string[],options?: NumberFormatOptions): string;toReversed(): Uint8ArrayArrayBuffer>;Copies the array and returns the copy with the elements in reverse order.toSorted(compareFn?: (a: number, b: number) => number): Uint8ArrayArrayBuffer>;Copies and sorts the array.@param compareFnFunction used to determine the order of the elements. It is expected to return a negative value if the first argument is less than the second argument, zero if they're equal, and a positive value otherwise. If omitted, the elements are sorted in ascending order.const myNums = Uint8Array.from([11, 2, 22, 1]); myNums.toSorted((a, b) => a - b) // Uint8Array(4) [1, 2, 11, 22] toString(): string;Returns a string representation of an array.valueOf(): this;Returns the primitive value of the specified object.values(): ArrayIteratornumber>;Returns an list of values in the arraywith(index: number,value: number): Uint8ArrayArrayBuffer>;Copies the array and inserts the given number at the provided index.@param indexThe index of the value to overwrite. If the index is negative, then it replaces from the end of the array.@param valueThe value to insert into the copied array.@returnsA copy of the original array with the inserted value.Resources
ReferenceDocsGuidesDiscordMerch StoreGitHubBlogToolkit
RuntimePackage managerTest runnerBundlerPackage runnerProject
Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San FranciscoWe're hiring →智能索引记录
-
2026-03-02 16:45:16
综合导航
成功
标题:Athletes from Sweden and the Netherlands Win Medals at the Olympic Winter Games Milano Cortina 2026 as Team TCL Ambassador Reaches the Podium
简介:/PRNewswire/ -- At the Olympic Winter Games Milano Cortina 2
-
2026-03-02 18:45:25
综合导航
成功
标题:被全家宠了番外最新章节_第50章 监视第1页_被全家宠了番外免费章节_恋上你看书网
简介:第50章 监视第1页_被全家宠了番外_年年穗岁_恋上你看书网
-
2026-03-02 21:05:38
综合导航
成功
标题:Michelle Brunnenstr. [Archiv] - BW7 Forum
简介:Hallo, Weiss jemand ob Michelle (blonde deutsche Dame) au
-
2026-03-02 21:37:21
游戏娱乐
成功
标题:为什么比格是大王最新章节_为什么比格是大王小说免费全文阅读_恋上你看书网
简介:【第二个副本完结】三岁半的比格大王意外卷入一场无限游戏。游戏系统发布任务:你必须在遍地疯子、杀人狂、怪物的恐怖世界存活,
-
2026-03-03 01:11:36
电商商城
成功
标题:奥伦提女装价格及图片表 - 京东
简介:京东是国内专业的奥伦提女装网上购物商城,本频道提供奥伦提女装价格及图片表、奥伦提女装商品价格多少钱,为您选购奥伦提女装提
-
2026-03-02 21:33:34
综合导航
成功
标题:çå¿®çæ¼é³_çå¿®çææ_çå¿®çç¹ä½_è¯ç»ç½
简介:è¯ç»ç½çå¿®é¢é,ä»ç»çå¿®,çå¿®çæ¼é³,çå¿®æ¯
-
2026-03-03 01:12:26
综合导航
成功
标题:ç®å®çæ¼é³_ç®å®çææ_ç®å®çç¹ä½_è¯ç»ç½
简介:è¯ç»ç½ç®å®é¢é,ä»ç»ç®å®,ç®å®çæ¼é³,ç®å®æ¯
-
2026-03-02 13:11:49
教育培训
成功
标题:家庭趣事作文(汇编15篇)
简介:在日常的学习、工作、生活中,大家对作文都再熟悉不过了吧,作文是人们把记忆中所存储的有关知识、经验和思想用书面形式表达出来
-
2026-03-02 18:47:04
数码科技
成功
标题:重生后,病娇大佬成了我的裙下臣第1章 重返牢笼_重生后,病娇大佬成了我的裙下臣_梦笔生花花公子_十二小说网_规则类怪谈扮演指南
简介:重生后,病娇大佬成了我的裙下臣最新章节第1章 重返牢笼出自梦笔生花花公子的作品重生后,病娇大佬成了我的裙下臣最新章节每天
-
2026-03-02 16:37:21
综合导航
成功
标题:ä¸è½èµä¸è¾çæ¼é³_ä¸è½èµä¸è¾çææ_ä¸è½èµä¸è¾çç¹ä½_è¯ç»ç½
简介:è¯ç»ç½ä¸è½èµä¸è¾é¢é,ä»ç»ä¸è½èµä¸è¾,ä¸è½è
-
2026-03-02 18:30:20
综合导航
成功
标题:Jedermann - 3-star hotel in Munich
简介:Free services for HRS guests at the Jedermann (Munich) : ✔ f
-
2026-03-03 00:41:19
游戏娱乐
成功
标题:雷霆之怒至尊版多倍爆率地图进入方法_欢乐园游戏
简介:雷霆之怒至尊版里想要得到更好的装备,多倍爆率地图是不可忽略的,那么怎么才能够进入多倍爆率地图呢?游戏内的多倍爆率地图隐藏
-
2026-03-02 16:38:15
综合导航
成功
标题:† Fensure. World English Historical Dictionary
简介:† Fensure. World English Historical Dictionary
-
2026-03-02 20:03:27
综合导航
成功
标题:2022级前三顺位均已提前续约 此外同届无人达成-中国·世俱杯官方用球(有限公司)-2025 Club World Cup
简介:北京时间2025年7月10日,今日早些时候,切特-霍姆格伦与雷霆达成提前续约,这意味着2022届前三顺位新秀全部提前续约
-
2026-03-02 11:42:39
综合导航
成功
标题:RIA.com – Купить луковичные растения (опт и розница) в Кривом Роге
简介:Луковичные растения в Кривом Роге недорого: продажа комнатны
-
2026-03-02 13:15:41
综合导航
成功
标题:盘龙之大地传说最新章节_第五十九章 迪莉娅来访第1页_盘龙之大地传说免费阅读_恋上你看书网
简介:第五十九章 迪莉娅来访第1页_盘龙之大地传说_不动星尘龙_恋上你看书网
-
2026-03-02 19:50:03
综合导航
成功
标题:Schaeffler Germany
简介:Schaeffler has been driving forward groundbreaking invention
-
2026-03-02 12:19:26
综合导航
成功
标题:写语文老师的作文3篇(精选)
简介:无论是在学校还是在社会中,大家都跟作文打过交道吧,作文可分为小学作文、中学作文、大学作文(论文)。你写作文时总是无从下笔
-
2026-03-03 01:29:29
博客创作
成功
标题:主线:释放(1)_消逝的光芒 图文全攻略 全主支线任务全剧情全收集品_3DM单机
简介:《消逝的光芒》图文全攻略(系统详细教程/全技能解析+全主线支线任务流程/全剧情+全稀有蓝紫橙蓝图/日志/笔记/邮件/雕像
-
2026-03-03 00:53:17
新闻资讯
成功
标题:哪种编程语言最适合区块链?, 站长资讯平台
简介:作者:Duomly 译者:罗远航 来源:InfoQ 区块链技术由于其安全、快速以及去中心化的特性(虽然不是所有项目都满足
-
2026-03-03 00:52:04
综合导航
成功
标题:厦门市翔安区一博优托管服务部招聘_厦门市翔安区一博优托管服务部 招聘_电话_地址 _【官方】
简介:厦门市翔安区一博优托管服务部招聘,厦门市翔安区一博优托管服务部 招聘,公司在厦门市翔安区香山街道汶沙里17-102,招聘
-
2026-03-02 13:11:49
综合导航
成功
标题:거산고구마 상품 후기 달콤하고 쫀득해요
简介:거산고구마 자연 그대로의 달콤함, 신선한 맛으로 고객 만족이 높아요
-
2026-03-03 00:38:03
综合导航
成功
标题:28.902.E102-0 P2F COB Connector
简介:COB P2F Befestigungselement zur Befestigung von COB-Connecto
-
2026-03-02 18:45:00
综合导航
成功
标题:AmpCon-Campus Management Platform - FS Singapore
简介:FS Ampcon-Campus Management Platform provides Day 0 to Day 2
-
2026-03-03 01:24:07
综合导航
成功
标题:2026年5月石家庄CFA报名官网报名网址是多少?报名入口在哪?-高顿教育
简介:2026年5月石家庄CFA报名官网报名网址是多少?报名入口在哪?最近有小伙伴咨询到学姐这个问题,今天学姐就来统一为大家进
-
2026-03-02 20:50:52
综合导航
成功
标题:å°ºæ³½çæ¼é³_å°ºæ³½çææ_尺泽çç¹ä½_è¯ç»ç½
简介:è¯ç»ç½å°ºæ³½é¢é,ä»ç»å°ºæ³½,å°ºæ³½çæ¼é³,尺泽æ¯
-
2026-03-02 21:34:07
数码科技
成功
标题:如何注册云服务平台账号及密码-云计算知识
简介:如何注册云服务平台账号及密码?注册云服务平台账号及密码,基本步骤是:进入云服务平台,点击登录与注册,进行新用户注册,填写
-
2026-03-02 18:53:40
综合导航
成功
标题:男款九眼天珠项链排行榜,男款九眼天珠项链十大排名推荐 - 京东
简介:小编为大家带来男款九眼天珠项链排行榜,男款九眼天珠项链十大排名推荐的文章,大家一起来看下相关内容吧。 1、莱旭(新品上架
-
2026-03-02 19:59:34
综合导航
成功
标题:Atmospheric Distortion Archives - Making Sense of the Infinite
简介:Atmospheric Distortion Archives - Making Sense of the Infini
-
2026-03-02 20:08:24
游戏娱乐
成功
标题:大卡车吃小汽车3,大卡车吃小汽车3小游戏,4399小游戏 www.4399.com
简介:4399为您提供大卡车吃小汽车3小游戏在线玩,大卡车吃小汽车3下载,大卡车吃小汽车3攻略秘籍。更多大卡车吃小汽车游戏尽在