GithubHelp home page GithubHelp logo

Request about trace.moe.js HOT 1 CLOSED

LuckyYam avatar LuckyYam commented on July 19, 2024
Request

from trace.moe.js.

Comments (1)

Exhabition avatar Exhabition commented on July 19, 2024

There is a function called getSimilarFromBuffer

More info here:

trace.moe.js/src/index.js

Lines 94 to 119 in af49697

/**
* @param {Buffer} buffer A valid buffer to upload (max 25MB)
* @param {Object} options An object with optional settings to add to the URL
* @param {Boolean} options.cutBorders Whether black borders should be cut or not
* @param {Number} options.anilistID A specific AniList ID to filter
* @param {Boolean} options.anilistInfo Whether to include extra AniList info (takes longer)
* @param {Boolean} options.useAdvancedPreviews Wether to use special media preview class instead of just a single url
* @returns {SearchResponse}
*/
async getSimilarFromBuffer(buffer, options) {
if (!buffer || !Buffer.isBuffer(buffer))
return new TypeError(`[getSimilarFromURL] 'buffer' should be a Buffer, got ${typeof buffer}`);
if (options?.anilistID && !Number.isInteger(parseInt(options.anilistID)))
return new TypeError(`[getSimilarFromURL] 'options.anilistID' should be an integer, got ${options.anilistID}`);
const urlSettings = getTraceSettings(null, options);
const result = await post(`${SEARCH_ENDPOINT}${urlSettings}`, {
body: buffer,
headers: { "Content-Type": "application/x-www-form-urlencoded" }
}).catch(error => error.response);
if (options?.useAdvancedPreviews) convertMediaPreviews(result.data?.result);
return result.data;
}
}

Let me know if you run into any issues

from trace.moe.js.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.