patch 9.1.0980: no support for base64 en-/decoding functions in Vim Script
Problem: no support for base64 en-/decoding functions in Vim Script
(networkhermit)
Solution: Add the base64_encode() and base64_decode() functions
(Yegappan Lakshmanan)
fixes: #16291
closes: #16330
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
48fa3198b7
commit
810785c689
@ -1,4 +1,4 @@
|
||||
*builtin.txt* For Vim version 9.1. Last change: 2024 Dec 03
|
||||
*builtin.txt* For Vim version 9.1. Last change: 2024 Dec 30
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -67,6 +67,8 @@ autocmd_get([{opts}]) List return a list of autocmds
|
||||
balloon_gettext() String current text in the balloon
|
||||
balloon_show({expr}) none show {expr} inside the balloon
|
||||
balloon_split({msg}) List split {msg} as used for a balloon
|
||||
base64_decode({string}) Blob base-64 decode {string} characters
|
||||
base64_encode({blob}) String base-64 encode the bytes in {blob}
|
||||
bindtextdomain({package}, {path})
|
||||
Bool bind text domain to specified path
|
||||
blob2list({blob}) List convert {blob} into a list of numbers
|
||||
@ -1169,6 +1171,43 @@ autocmd_get([{opts}]) *autocmd_get()*
|
||||
Return type: list<dict<any>>
|
||||
|
||||
|
||||
base64_decode({string}) *base64_decode()*
|
||||
Return a Blob containing the bytes decoded from the base64
|
||||
characters in {string}.
|
||||
|
||||
The {string} argument should contain only base64-encoded
|
||||
characters and should have a length that is a multiple of 4.
|
||||
|
||||
Returns an empty blob on error.
|
||||
|
||||
Examples: >
|
||||
" Write the decoded contents to a binary file
|
||||
call writefile(base64_decode(s), 'tools.bmp')
|
||||
" Decode a base64-encoded string
|
||||
echo list2str(blob2list(base64_decode(encodedstr)))
|
||||
<
|
||||
Can also be used as a |method|: >
|
||||
GetEncodedString()->base64_decode()
|
||||
<
|
||||
Return type: |Blob|
|
||||
|
||||
|
||||
base64_encode({blob}) *base64_encode()*
|
||||
Return a base64-encoded String representing the bytes in
|
||||
{blob}. The base64 alphabet defined in RFC 4648 is used.
|
||||
|
||||
Examples: >
|
||||
" Encode the contents of a binary file
|
||||
echo base64_encode(readblob('somefile.bin'))
|
||||
" Encode a string
|
||||
echo base64_encode(list2blob(str2list(somestr)))
|
||||
<
|
||||
Can also be used as a |method|: >
|
||||
GetBinaryData()->base64_encode()
|
||||
<
|
||||
Return type: |String|
|
||||
|
||||
|
||||
balloon_gettext() *balloon_gettext()*
|
||||
Return the current text in the balloon. Only for the string,
|
||||
not used for the List. Returns an empty string if balloon
|
||||
|
||||
@ -6164,6 +6164,8 @@ balloon_show() builtin.txt /*balloon_show()*
|
||||
balloon_split() builtin.txt /*balloon_split()*
|
||||
bar motion.txt /*bar*
|
||||
bars help.txt /*bars*
|
||||
base64_decode() builtin.txt /*base64_decode()*
|
||||
base64_encode() builtin.txt /*base64_encode()*
|
||||
base_font_name_list mbyte.txt /*base_font_name_list*
|
||||
basic.vim syntax.txt /*basic.vim*
|
||||
beep options.txt /*beep*
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
*todo.txt* For Vim version 9.1. Last change: 2024 Dec 16
|
||||
*todo.txt* For Vim version 9.1. Last change: 2024 Dec 30
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -4198,8 +4198,6 @@ Vim script language:
|
||||
char2hex() convert char string to hex string.
|
||||
crypt() encrypt string
|
||||
decrypt() decrypt string
|
||||
base64enc() base 64 encoding
|
||||
base64dec() base 64 decoding
|
||||
attributes() return file protection flags "drwxrwxrwx"
|
||||
shorten(fname) shorten a file name, like home_replace()
|
||||
perl(cmd) call Perl and return string
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
*usr_41.txt* For Vim version 9.1. Last change: 2024 Nov 11
|
||||
*usr_41.txt* For Vim version 9.1. Last change: 2024 Dec 30
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@ -1263,6 +1263,8 @@ Inter-process communication: *channel-functions*
|
||||
json_decode() decode a JSON string to Vim types
|
||||
js_encode() encode an expression to a JSON string
|
||||
js_decode() decode a JSON string to Vim types
|
||||
base64_encode() encode a blob into a base64 string
|
||||
base64_decode() decode a base64 string into a blob
|
||||
err_teapot() give error 418 or 503
|
||||
|
||||
Jobs: *job-functions*
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
*version9.txt* For Vim version 9.1. Last change: 2024 Dec 29
|
||||
*version9.txt* For Vim version 9.1. Last change: 2024 Dec 30
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -41629,13 +41629,15 @@ Various syntax, indent and other plugins were added.
|
||||
|
||||
Functions: ~
|
||||
|
||||
|base64_decode()| decode a base64 string into a blob
|
||||
|base64_encode()| encode a blob into a base64 string
|
||||
|bindtextdomain()| set message lookup translation base path
|
||||
|diff()| diff two Lists of strings
|
||||
|filecopy()| copy a file {from} to {to}
|
||||
|foreach()| apply function to List items
|
||||
|getcellpixels()| get List of terminal cell pixel size
|
||||
|getcmdcomplpat()| Shell command line completion
|
||||
|getcmdprompt()| get prompt for input()/confirm()
|
||||
|getcellpixels()| get List of terminal cell pixel size
|
||||
|getregion()| get a region of text from a buffer
|
||||
|getregionpos()| get a list of positions for a region
|
||||
|id()| get unique identifier for a Dict, List, Object,
|
||||
|
||||
Reference in New Issue
Block a user