GET folders
This function lists all the folders in a namespace.
Usage
This function takes in 2 parameters - namespace & filter. The filter supports the IMAP wildcards (* matches everything, % matches everything at the current hierarchy level).
let folders = await imap.getFolders("INBOX/", "*")
The response is a typed Folder[]:
type Folder = {
name: string, // e.g. "INBOX/Archive"
delimiter: string, // e.g. "/"
attributes: string[] // e.g. ["HasNoChildren", "Drafts"] (no backslash)
}
[
{
name: 'INBOX/Archive',
delimiter: '/',
attributes: [ 'HasNoChildren' ]
},
{
name: 'INBOX/draft',
delimiter: '/',
attributes: [ 'HasNoChildren', 'Drafts' ]
}
// [...]
]
info
Folder names containing spaces, quotes or other special characters (including names returned as IMAP literals by the server) are parsed correctly. On IMAP4rev1-only servers, folder names are converted from/to modified UTF-7 (RFC 2152) automatically — on IMAP4rev2 sessions they are plain UTF-8.