mirror of
https://github.com/neovim/neovim.git
synced 2024-09-17 20:58:20 -04:00
fixup! gen vimdoc
This commit is contained in:
parent
fd6832285f
commit
bc95b53469
@ -4436,50 +4436,76 @@ tohtml.tohtml({winid}, {opt}) *tohtml.tohtml.tohtml()*
|
||||
==============================================================================
|
||||
Lua module: vim.net *vim.net*
|
||||
|
||||
vim.net.download({url}, {opts}) *vim.net.download()*
|
||||
Asynchronously download a file
|
||||
*vim.net.Request*
|
||||
|
||||
Fields: ~
|
||||
• {wait} (`fun(self: vim.net.Requesttimeout: integer?)`)
|
||||
• {kill} (`fun(self: vim.net.Requestsignal: integer|string)`)
|
||||
|
||||
|
||||
Request:kill({signal}) *Request:kill()*
|
||||
|
||||
Parameters: ~
|
||||
• {signal} (`integer|string`)
|
||||
|
||||
Request:wait({timeout}) *Request:wait()*
|
||||
|
||||
Parameters: ~
|
||||
• {timeout} (`integer?`)
|
||||
|
||||
vim.net.request({url}, {opts}) *vim.net.request()*
|
||||
Download a file
|
||||
|
||||
Parameters: ~
|
||||
• {url} (`string`) Request URL
|
||||
• {opts} (`table?`) Additional options
|
||||
|
||||
Example: >lua
|
||||
-- Download a file
|
||||
-- The file will be saved in the `cwd` with the name `anything`
|
||||
vim.net.download("https://httpbingo.org/anything")
|
||||
|
||||
-- Download a file to a path
|
||||
-- The file will be saved in `/tmp/somefile`
|
||||
vim.net.download("https://httpbingo.org/anything", {
|
||||
as = "tmp/somefile",
|
||||
})
|
||||
|
||||
-- Download a file while sending headers
|
||||
vim.net.download("https://httpbingo.org/anything", {
|
||||
headers = {
|
||||
Authorization = { "Bearer foo" },
|
||||
},
|
||||
})
|
||||
|
||||
-- Download a file while handling basic auth
|
||||
vim.net.download("https://httpbingo.org/basic-auth/user/password", {
|
||||
credentials = "user:password",
|
||||
})
|
||||
<
|
||||
• {as}? (`string`) Path to write the downloaded file to. If
|
||||
• {file}? (`string`) Path to write the downloaded file to. If
|
||||
not provided, the one inferred from the URL will be used.
|
||||
Defaults to `nil`
|
||||
• {credentials}? (`string`) Credentials with the format
|
||||
• {user}? (`string`) Credentials with the format
|
||||
`username:password`. Defaults to `nil`
|
||||
• {raw}? (`boolean`) Disables all internal HTTP decoding of
|
||||
content or transfer encodings. Unaltered, raw, data is
|
||||
passed. Defaults to `false`
|
||||
• {headers}? (`table<string, string[]>`) Request headers.
|
||||
Defaults to `nil`
|
||||
• {redirect_credentials}? (`boolean`) Whether `credentials`
|
||||
should be send to host after a redirect. Defaults to `false`
|
||||
• {location_trusted}? (`boolean`) Whether `user` should be
|
||||
send to host after a redirect. Defaults to `false`
|
||||
• {on_exit}? (`fun(err: string?)`) Optional callback. Defaults
|
||||
to showing a notification when the file has been downloaded.
|
||||
to `nil`
|
||||
|
||||
Return: ~
|
||||
(`vim.net.Request`) request
|
||||
|
||||
Example: >lua
|
||||
-- Download a file (async)
|
||||
-- The file will be saved in the `cwd` with the name `anything`
|
||||
vim.net.request("https://httpbingo.org/anything")
|
||||
|
||||
-- Download a file (sync)
|
||||
-- The file will be saved in the `cwd` with the name `anything`
|
||||
vim.net.request("https://httpbingo.org/anything"):wait(500)
|
||||
|
||||
-- Download a file to a path (async)
|
||||
-- The file will be saved in `/tmp/somefile`
|
||||
vim.net.request("https://httpbingo.org/anything", {
|
||||
file = "/tmp/somefile",
|
||||
})
|
||||
|
||||
-- Download a file while sending headers (async)
|
||||
vim.net.request("https://httpbingo.org/anything", {
|
||||
headers = {
|
||||
Authorization = { "Bearer foo" },
|
||||
},
|
||||
})
|
||||
|
||||
-- Download a file while handling basic auth (async)
|
||||
vim.net.request("https://httpbingo.org/basic-auth/user/password", {
|
||||
user = "user:password",
|
||||
})
|
||||
|
||||
```. See |vim.net.Request|.
|
||||
<
|
||||
|
||||
|
||||
vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:
|
||||
|
@ -2,8 +2,6 @@ local M = {}
|
||||
|
||||
---@class vim.net.Request
|
||||
---@field private _system vim.SystemObj
|
||||
---@field wait fun(self: vim.net.Request, timeout?: integer): string?
|
||||
---@field kill fun(self: vim.net.Request, signal: integer|string)
|
||||
local Request = {}
|
||||
|
||||
--- @param system vim.SystemObj
|
||||
|
Loading…
Reference in New Issue
Block a user