ScreenCapture - A replacement for screenshot-basic [OPEN-SOURCE]

Available now: Release v0.1.0 · itschip/screencapture · GitHub

For the moment, only: requestScreenshotUpload

v0.1.2

  • Uses Node 22
  • Updated to use Koa router, instead of the old raw implementation of SetHttpHandler
2 Likes

Unfortunately actual version of NPWD user the “requestClientScreenshot” export…

exp[‘screenshot-basic’].requestClientScreenshot(

Hey!

Yes, you’re right. I haven’t gotten to those server-side exports yet. Will do shortly.

1 Like

v0.3.0

  • Fixes issues with formidable not being found.
1 Like

Hey mate, any further information on the examples and how this works? Where do we put this?

RegisterCommand(
    'capture',
    (_: string, args: string[]) => {
      exp.screencapture.serverCapture(
        args[0],
        { encoding: 'webp' },
        (data: string | Buffer<ArrayBuffer>) => {
          data = Buffer.from(data as ArrayBuffer);
  
          fs.writeFileSync('./blob_image.webp', data);
          console.log(`File saved`);
        },
        'blob',
      );
    },
    false,
  );

Server-side code.

Is it possible to use it with Lua?

Do you have a discord I get in touch with you by? I have some ideas for the resource if you’re interested to hear them

For anyone using vanilla JS: bufferData = Buffer.from(Object.values(data));

Hi !

Here’s an exemple (base64)

exports.screencapture:serverCapture(playerId, {
    encoding = "webp",
    quality = 0.1,
}, function(data)
    local imageSRC = tostring("data:image/webp;base64, "..data)

    -- Do your stuff
    
end, "base64")
1 Like

Is there a way to make it compatible with discord-screenshot? I tried a lot to get it working but i just get a TypeError: Failed to fetch (@screencapture/game/nui/dist/assets/index-DrORwDH6.js:17)

Hey! What exactly is discord-screenshot? Do you have a link for it?

Hey, this is the resource I was referring to: GitHub - jaimeadf/discord-screenshot: A resource for FiveM that captures the screen of a player and uploads it to a discord webhook.

However, I believe the issue is related to ScreenCapture. SirLamaGott already informed you about it (TypeError: Failed to fetch @screencapture/game/nui/dist/assets/index-DrORwDH6.js:17).