chore(v1.34.7): bump version and generate docs
This commit is contained in:
parent
211205363c
commit
f935b50011
77 changed files with 5207 additions and 2669 deletions
53
docs/structures_MessageMedia.js.html
generated
53
docs/structures_MessageMedia.js.html
generated
|
|
@ -4,7 +4,7 @@
|
|||
<head>
|
||||
<meta name="generator" content="JSDoc 3.6.11">
|
||||
<meta charset="utf-8">
|
||||
<title>whatsapp-web.js 1.34.6 » Source: structures/MessageMedia.js</title>
|
||||
<title>whatsapp-web.js 1.34.7 » Source: structures/MessageMedia.js</title>
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
||||
<link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
<nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
||||
<div id="jsdoc-navbar-container">
|
||||
<div id="jsdoc-navbar-content">
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>34.<wbr>6</a>
|
||||
<a href="index.html" class="jsdoc-navbar-package-name">whatsapp-web.<wbr>js 1.<wbr>34.<wbr>7</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
@ -63,7 +63,7 @@ class MessageMedia {
|
|||
* @type {?string}
|
||||
*/
|
||||
this.filename = filename;
|
||||
|
||||
|
||||
/**
|
||||
* Document file size in bytes. Value can be null
|
||||
* @type {?number}
|
||||
|
|
@ -73,12 +73,12 @@ class MessageMedia {
|
|||
|
||||
/**
|
||||
* Creates a MessageMedia instance from a local file path
|
||||
* @param {string} filePath
|
||||
* @param {string} filePath
|
||||
* @returns {MessageMedia}
|
||||
*/
|
||||
static fromFilePath(filePath) {
|
||||
const b64data = fs.readFileSync(filePath, {encoding: 'base64'});
|
||||
const mimetype = mime.getType(filePath);
|
||||
const b64data = fs.readFileSync(filePath, { encoding: 'base64' });
|
||||
const mimetype = mime.getType(filePath);
|
||||
const filename = path.basename(filePath);
|
||||
|
||||
return new MessageMedia(mimetype, b64data, filename);
|
||||
|
|
@ -100,16 +100,25 @@ class MessageMedia {
|
|||
let mimetype = mime.getType(pUrl.pathname);
|
||||
|
||||
if (!mimetype &amp;&amp; !options.unsafeMime)
|
||||
throw new Error('Unable to determine MIME type using URL. Set unsafeMime to true to download it anyway.');
|
||||
throw new Error(
|
||||
'Unable to determine MIME type using URL. Set unsafeMime to true to download it anyway.',
|
||||
);
|
||||
|
||||
async function fetchData (url, options) {
|
||||
const reqOptions = Object.assign({ headers: { accept: 'image/* video/* text/* audio/*' } }, options);
|
||||
async function fetchData(url, options) {
|
||||
const reqOptions = Object.assign(
|
||||
{ headers: { accept: 'image/* video/* text/* audio/*' } },
|
||||
options,
|
||||
);
|
||||
const response = await fetch(url, reqOptions);
|
||||
const mime = response.headers.get('Content-Type');
|
||||
const size = response.headers.get('Content-Length');
|
||||
|
||||
const contentDisposition = response.headers.get('Content-Disposition');
|
||||
const name = contentDisposition ? contentDisposition.match(/((?&lt;=filename=")(.*)(?="))/) : null;
|
||||
const contentDisposition = response.headers.get(
|
||||
'Content-Disposition',
|
||||
);
|
||||
const name = contentDisposition
|
||||
? contentDisposition.match(/((?&lt;=filename=")(.*)(?="))/)
|
||||
: null;
|
||||
|
||||
let data = '';
|
||||
if (response.buffer) {
|
||||
|
|
@ -121,19 +130,23 @@ class MessageMedia {
|
|||
});
|
||||
data = btoa(data);
|
||||
}
|
||||
|
||||
|
||||
return { data, mime, name, size };
|
||||
}
|
||||
|
||||
const res = options.client
|
||||
? (await options.client.pupPage.evaluate(fetchData, url, options.reqOptions))
|
||||
: (await fetchData(url, options.reqOptions));
|
||||
? await options.client.pupPage.evaluate(
|
||||
fetchData,
|
||||
url,
|
||||
options.reqOptions,
|
||||
)
|
||||
: await fetchData(url, options.reqOptions);
|
||||
|
||||
const filename = options.filename ||
|
||||
(res.name ? res.name[0] : (pUrl.pathname.split('/').pop() || 'file'));
|
||||
|
||||
if (!mimetype)
|
||||
mimetype = res.mime;
|
||||
const filename =
|
||||
options.filename ||
|
||||
(res.name ? res.name[0] : pUrl.pathname.split('/').pop() || 'file');
|
||||
|
||||
if (!mimetype) mimetype = res.mime;
|
||||
|
||||
return new MessageMedia(mimetype, res.data, filename, res.size || null);
|
||||
}
|
||||
|
|
@ -150,7 +163,7 @@ module.exports = MessageMedia;
|
|||
<footer id="jsdoc-footer" class="jsdoc-footer">
|
||||
<div id="jsdoc-footer-container">
|
||||
<p>
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.11 on January 30, 2026.
|
||||
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.11 on April 24, 2026.
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
|||
Loading…
Reference in a new issue